Site icon Database Tutorials

How to reset to MySQL root password

 

Some time we are facing issue like we forgot the MySQL root password. So here we are providing just some simple steps to reset the MySQL root password.

Stop the MySQL service

 

Note :- In Redhat-7 or Centos-7 use below command to stop the service.

 

Start the mysql service with –skip-grant-tables option

 

Note:- If above command does not work in your environment then put skip-grant-tables into the my.cnf, because in some Linux platform mysqld_safe will not work.

 

Login into the MySQL with blank password

 

Update the root password

 

Stop the MySQL service

 

Note :- In redhat-7 or Centos-7 use below command to stop the service.

 

Start the service again.

Note:- If you have put entry of skip-grant-tables into the my.cnf file then first remove this variable, before starting the MySQL service.

 

Note :- In redhat-7 or Centos-7 use below command to start the service.

 

Login with the updated password.

Exit mobile version