MySQL database forgot root password is a very painful thing, even if you uninstall the database reinstall, password still can not reset, today this thing makes me extremely headache, finally, found a solution.
The actual operation under Windows is as follows:
1. Close the running MySQL database.
2. Open the DOS window and go to the bin file under the MySQL installation directory. such as:C:\Program files\mysql\bin
3. DOS continues Enter Mysqld--skip-grant-tables, and then enter in Safe mode. If the message doesn't appear, it's right.
4. Now reopen a DOS window, go to the MySQL installation directory under the bin file. Enter Mysql-uroot-p, then prompt for the password, do not enter, directly enter.
5. Enter Update Mysql.user set Password=password (' NewPassword ') where user= ' root '; the newpassword here is the new password to be set, and the following number is required.
6, Refresh the permissions table input flush privileges;
7, Exit DOS.
8. Restart the MySQL service.
A. Open the Task Manager and end the Mysql-nt.exe process.
B. Restart MySQL service.
This time the password has been modified successfully, you can log into the database with the new password.
MySQL database forgot root password, how to modify