Windows edition
Stop MySQL service first
Open the CMD Command window and enter the CD/D installation directory
Mysqld--skip-grant-table
Then open a CMD command window and enter the CD/D installation directory as well.
Mysql-uroot-p and then enter.
Use MySQL
Update Mysql.user Set Password=password (' Enter the password you want to change ') where user= ' root ';
Flush privileges;
Quit
Restarting the MySQL service will allow you to enter with a new password.
Linux edition
Stop MySQL service first
Mysqld_safe--skip-grant-table &//Start without checking permissions
Mysql-uroot-p and then enter.
Use MySQL
Update Mysql.user Set Password=password (' Enter the password you want to change ') where user= ' root ';
Flush privileges;
Quit
Restarting the MySQL service will allow you to enter with a new password.
This article is from the "high-anti-server sales, bring operation and maintenance" blog, please be sure to keep this source http://kenvik.blog.51cto.com/11000054/1858439
Modify the MySQL database root password (forget root password)