Forgetting the root password of MySQL is a daunting problem.
Let's take a look at how to reset the root password below Windows7.
1. Open a command-line window: It is important to note that you should open it as an administrator;
2. Turn off MySQL service: net stop MySQL
3, run Mysqld--skip-grant-tables. This command is to let MySQL boot time to skip the authorization table, it is important to note that there are many places on the internet is mysqld-nt, but the new version has been replaced by MYSQLD.
4. Reopen a command-line window (open with administrator),
Run command: mysql-u root; Enter MySQL without entering the password at this time;
Use MySQL; Select MySQL database;
Update user Set Password = Password (' newpass ') where user = ' root '; Do not forget the password function, the field is not case-sensitive, but the best capitalization is the first letter.
5, running flush privileges; To flush Cached permissions
6, Eixt; Quit MySQL
7, mysql-u root-p login mysql with new password
Running the Mysqld,mysql command above, you need to add the bin directory under the MySQL installation directory into the environment variable. Otherwise you need to go to the bin directory to run each command.