Time: 2014.01.19
Location: Base
Bytes ----------------------------------------------------------------------------------------
I. background
Wow, when I debugged the code this evening, I found that the MySQL database could not be opened because of a wrong password. I used it well and didn't know how to change the password. Why, after a long time, I finally solved the problem. ,
My system environment: Win7 + MySQL 5.6
Bytes ----------------------------------------------------------------------------------------
2. Solution steps
0. My MySQ installation path is: D: \ Program Files \ MySQL
1. Switch to the disk in cmd first.
Input-> D:
Enter-> cd "D: \ Program Files \ MySQL Server 5.6 \ bin", pay attention to double quotation marks, so that we can switch to the MySQL installation directory.
2. Start MySQL in safe mode, that is, do not enter the password to enter the database
Enter-> mysqld-nt -- skip-grant-tables. Note the space between the parameters and the marker after the two bars. This step is very important.
3. re-open a cmd window and follow the preceding steps to open the MySQL installation directory and run MySQL
Input-> d:
Input-> cd "D: \ Program Files \ MySQL Server 5.6 \ bin"
Input-> D: \ Program Files \ MySQL Server 5.6 \ bin> mysql-uroot-p
Tip-> Enter password:
Press space
4. Force modify the root user password
Enter-> update mysql. user set password = PASSWORD ('new password') where User = 'root'; note that there is a dot between mysql and user. because mysql has been started, add a semicolon at the end of the statement.
5. Refresh Permissions
Enter-> flush privileges;
----------------------------------------------------------
Iii. Postscript
Friend, if you happen to encounter this problem and find it again, please feel free to follow the above steps. You will succeed!