How to recovery mysql root password if you forgot it.
One of the recovery methods for a .MySQL passwordIf you forget the MySQL root password, you can use the following methods to re-set:1. Switch to rootSu root2. KILL out of the system in the MySQL process;Killall -TERM mysqld3. Start MySQL with the following command to start without checking the permissions;Safe_mysqld --skip-grant-tables &4. Then use the empty password to use the root user login to MySQL;Mysql -u root5. Modify the root user's password;Mysql> update mysql.user set authentication_string= PASSWORD ('123456') where User = 'root';Mysql> flush privileges;Mysql> quitRestart MySQL, you can use the new password login.Second, the MySQL password recovery method IIThere may be no system safe_mysqld procedures (ubuntu operating
system, apt-get installed mysql), the following method can be restored1. Switch to rootSu root2. stop mysqld;
/etc/init.d/mysql stop3. Start MySQL with the following command to start without checking the permissions;Mysqld --skip-grant-tables &4. Then use the empty password to use the root user login to MySQL;Mysql -u root4. Modify the root user password 123456 (of course, you need to 123456 into the password you want to set);Mysql> update mysql.user set authentication_string= PASSWORD ('123456') where User = 'root';Mysql> flush privileges;Mysql> quitReboot MySQL/etc/init.d/mysql restartYou can use the new password 123456 login.
Mysql have changed the column "password" to "authentication_string"
/etc/init.d/mysql stop3. Start MySQL with the following command to start without checking the permissions;Mysqld --skip-grant-tables &4. Then use the empty password to use the root user login to MySQL;Mysql -u root4. Modify the root user password 123456 (of course, you need to 123456 into the password you want to set);Mysql> update mysql.user set authentication_string= PASSWORD ('123456') where User = 'root';Mysql> flush privileges;Mysql> quitReboot MySQL/etc/init.d/mysql restartYou can use the new password 123456 login.
Mysql have changed the column "password" to "authentication_string"
Comments
Post a Comment