1. Stop MySQL service, CMD Open DOS window, enter net stop MySQL
2, in the CMD Command Line window, go to MySQL installation directory such as E:\Program files\mysql\mysql Server 5.0\bin
Demonstration command:
Enter e: Carriage return,
Enter CD "E:\Program files\mysql\mysql Server 5.0\bin"
Note that double quotation marks are also entered so that you can enter the MySQL installation directory.
3, enter the MySQL security mode, that is, when MySQL up, you can enter the database without entering a password.
The command is: Mysqld-nt--skip-grant-tables
Note: Check the Mysql/bin directory of the execution program, some databases are mysqld.exe, it is necessary to change to: Mysqld--skip-grant-tables
4, re-open a CMD command line window, enter mysql-uroot-p, use a blank password to log in to MySQL (Do not enter the password, directly press ENTER)
5, enter the following command to start modifying the root user's password (note: there is a "dot" in the middle of the Mysql.user command)
mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root ';
6, Refresh the permissions table
mysql> flush Privileges;
7, exit
Mysql> quit
This way, the MySQL Super Admin account Root has been reset, and then it ends in the task manager.mysqld/mysqld-nt.exe This process, restart MySQL! (You can also restart the server directly)
After MySQL restarts, you can log in to MySQL with the new root password!
Method Two:
First create a new pwdhf.txt in the MySQL installation directory, enter the text: SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' * * * * * * ');
The red part is the new password that needs to be set
Stop the MySQL service with the Windows Service Administration tool or Task Manager (Task Manager K-Drop MYSQLD-NT process)
DOS command prompt to the bin directory under the MySQL installation directory as mine is D:\Program files\mysql\mysql Server 5.1\bin
Then run: Mysqld-nt--init-file=. /pwdhf.txt
After execution stop MySQL database service (Task Manager k off Mysqld-nt process), and then restart MySQL in normal mode