How to recover mysql root password ?

Sometime we needed to restore the password, for that we are going to see the Easy steps to recover mysql root password with the help of following steps.

Steps:

Step 1: Stop mysql daemon

Step 2: Start mysql service in safe mode by excluding grant tables to avoid password, ‘&’ used  for running the service in background.

Step 3: Connect to mysql as root user using mysql client command line utility.

Step 4: Set reset the mysql root password using below commands in mysql console.

Step 5: Stop mysql server daemon .

Step 6: Start mysql server daemon again and login as root with new password.

 

 

Let us see the steps in Details : 

 

Step 1 : Stop mysql daemon.

[root@experts ~]#service mysqld stop

Step 2 : Start mysql service in safe mode by excluding grant tables to avoid password, ‘&’ used  for running the service in background.

[root@experts ~]#mysqld_safe –skip-grant-table &

Step 3 : Connect to mysql as root user using mysql client command line utility.

[root@experts ~]#mysql -u root

Step 4 : Set reset the mysql root password using below commands in mysql console.

mysql>use mysql;

mysql> update user set password=PASSWORD(“root123″) where User=’root’;

mysql> flush privileges; 

mysql> exit;

Note:

use mysql; // mysql database stores all user related information like user name , password and permissions

update user set password=PASSWORD(“new-password”) where User=’root’; // set new password for mysql root user.

flush privileges;  //commit the changes to database .

Step 5 : Stop mysql server daemon .

[root@experts ~]#service mysqld stop

Step 6 : Start mysql server daemon again and test login as root .

[root@experts ~]#service mysqld start

[root@experts ~]#mysql -u root -p

Thanks for watching.

For more more detail you can watch Video and also Subscribe for more Videos :

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk