1. Close the running MySQL service
2. Open the DOS window and go to the Mysql\bin directory
3. Enter Mysqld--skip-grant-tables carriage return --skip-grant-tables means to skip permission table authentication when starting the MySQL service
4. Open a DOS window again (because the DOS window is no longer moving), go to the Mysql\bin directory
5. Enter MySQL return, if successful, a MySQL prompt will appear >
6. Connection rights database: use MySQL;
6. Change Password: Update user set Password=password ("root") where user= "root";
mysql5.7 above version--UPDATE user SET Authentication_string=password ("root") WHERE user= "root";
7. Refresh permissions (required steps): Flush privileges;
8. Quit quit.
9. Log out of the system and then enter, using the username root and the new password you just set 123 to log in.
MySQL forgot password what to do