Recover the MySQL Root Password Easily

Photo of author

By rasho

To recover your MySQL database server password follow these five easy steps..
Step 1:
Stop the MySQL service..

service mysql stop

or

service mysqld stop

Step 2:
Start the MySQL server without any passwords..

mysqld_safe --skip-grant-tables &

Step 3:
Connect to mysql server using mysql client..

mysql -u root

Step 4:
Setup new MySQL root user password by running the commands below in order..

use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
flush privileges;
quit

Step 5:
Stop MySQL Server..

service mysql stop

Or

service mysqld stop

Step 6:
Start MySQL server and test it

service mysql start

Or

service mysqld start

Then..

1 thought on “Recover the MySQL Root Password Easily”

Leave a Comment