In Windows forgot the root password of MySQL for the novice, also will often encounter, I also happen to meet, refer to the solution on the Internet, and then tidy up a bit.
1. First, you need to see if the MySQL service is started.
Open cmd window, enter command: net start
2. If the MySQL service is already started, you will need to stop the MySQL service first.
Command: net stop MySQL
3. After you switch to your local mysqld installation directory, execute the following command:
Mysqld--defaults-file="C:\Program files\mysql\mysql Server 5.5\my.ini" --console--skip-grant-tables
Note: The path of the My.ini file under the Black font for your own local MySQL address
This command can skip the security check and turn on the MySQL service so you don't need to enter a password to connect to MySQL
4. Keep this cmd window not closed, new open a CMD window, log in to MySQL.
Command: Mysql-uroot-p
Appear:
Enter Password:
No need to enter the password, directly press ENTER button, will enter the MySQL database
5. Next, you can use the password Modification command to change the password.
Command:
Update user Set Password = password (' new password ') where user = ' root ';
6. Last Refresh Permissions
Command:
Flush privileges;
7. Exit
Command: Quit
8. Close all cmd windows and reopen a new CMD window, note: The MySQL service needs to be restarted
Start mysql service command: net start MySQL
After the 9.mysql service starts, enter the mysql login command to log in
Command: mysql-uroot-p New password
Windows forgot MySQL root password solution (graphic)