Reset forgotten MySQL root password
If you forgot your MySQL root password, then this article will help you. This article explains how to reset a forgotten mysql root password. This process require root access on the server.
Here are the steps:
1. Stop MySQL daemon
# /etc/init.d/mysqld stop
2. Start the mysql daemon but skip the grant tables which store the passwords.
# /usr/bin/mysqld_safe --skip-grant-tables
You should see mysqld start up successfully
3. Login Using MySQL root User Without Entering Password
# mysqld -u root mysql
4. Set MySQL root password to a new password using UPDATE command
mysql> UPDATE user SET password=PASSWORD('new-password') WHERE user='root';
mysql> flush privileges;
5. Stop MySQL Daemon
# /etc/init.d/mysqld stop
6. Start MySQL Daemon normally
# /etc/init.d/mysqld start
7. Login to MySQL with the new password
# mysql -u root -p
Tags: mysql, reset passowrd