What if MySQL forgets its password sometimes? I will give a case and explanation! Solve the problem! The actual operations in windows are as follows:
1. Disable running MySQL.
2. Open the DOS window and go to the MySQL \ bin directory.
3. Enter mysqld -- skip-grant-tables and press Enter. If no prompt is displayed, it is correct.
4. Open another DOS window (because the DOS window can no longer be moved) and go to the MySQL \ bin directory.
5. Enter MySQL and press Enter. If yes, a MySQL prompt is displayed.>
6. Connect to the permission database> use MySQL; (> is the original prompt, don't forget the last semicolon)
6. Change the password:> Update user SET Password = PASSWORD ("520") where user = "root"; (do not forget the last semicolon)
7. Refresh permissions (required steps)> flush privileges;
8. Exit> \ q
9. log out of the system, log on to MySQL, and log on to MySQL with the username "root" and the new password "123456.