Many times there will be forgotten or lost the MySQL root password situation, I would like to clean up the solution, I hope to the friends of the newly-learned Linux help.
I. Modification of MY.CNF
Add Skip-grant-tables
Second, find the MySQL bin file/usr/bin
./mysqladmin-uroot Password ' admin888 '
Third, set up remote connection
Mysql-u root-p
Grant all on * * to ' root ' @ '% ' identified by ' admin888 ';
(in order to test, in fact, can not open)
Using the client (client software such as Phpadmin) to view the remote connection database, the migrated database is not recovered.
Iv. Login and Change password with new password
Mysql-uroot-p
Select User,password,host from Mysql.user;
Update user set Password=password ("password") where user= ' root ';
Flush privileges;
V. Close remote connections
Believe that this step, we have already set.
Modify MY.CNF Delete Skip-grant-tables
Log in to MySQL, set the remote user off
Update user Set host = '% ' where user = ' root ';
Select Host, user from user;
New password native Connection Try it, the password is changed.
Linux on turn off MySQL remote