1  find the bin directory under the mysql installation directory, copy the bin directory

2 Open the console as an administrator

3 switch to the bin directory.

4. Stop the mysql service first. There are two ways 
   1. Using the command net stop mysql 

2 Method: win+R enter services.msc carriage return, then find mysql, right click stop

5. Next, then just the bin directory there, enter the command mysqld –skip-grant-tables which is to skip password verification, then need to reopen A command window, just that can not be used (knock on the blackboard, focus on the key, take a small notebook to write down, to re-open the administrator command window) into the bin directory, enter mysql, this time you can enter the database.

6. Use The command shows databases; you can see the contents of the database, where the mysql library is the place to save the username. Enter use mysql; select mysql database

7. show tables to view all the tables, you will find a user table, where the user name, password, permissions and other account information is stored.

8. Enter select user,host,password from user; to view the account information.

9. Change the root password, enter update user set password=password(‘root’) where user=’root’ and host=’localhost’; change the password to root here. Prompt Query ok to modify it.

10. View again Account information, select user, host, password from user; can see that the password has been modified

11. Exit the command line, restart the mysql database, enter mysql -uroot -p in the bin directory, press Enter, you will be prompted to enter the password, this time with a new password to log in, you can log in.