Locate the profile My.ini, and then open it, and you can choose to open it in Notepad, looking for the following method:
After opening, search for mysqld keyword
When found, add skip-grant-tables below mysqld to save the exit.
PS: If prompted not to save, you can cut the file to the desktop, change the save and then copy to the MySQL directory
Then run cmd
Input Mysql-u root-p can be used without password login, appear password: When the direct enter can enter.
1. Go to MySQL database:
mysql> use MySQL;
Database changed
2. Set a new password for the root user, and enter the blue section yourself:mysql> Update user set Password=password ("123456") where user= "root";
Query OK, 1 rows affected (0.04 sec) rows Matched:1 changed:1 warnings:0
3. Refresh the database mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
4. Quit mysql:mysql> quit
Bye
ps:123456 for the new password, users can change their own password according to their own needs
Forget the MySQL database root password