Method One:
In the My.ini [mysqld] field, add:
Skip-grant-tables
Restart the MySQL service when MySQL does not require a password to log in to the database
And then into MySQL.
Mysql>use MySQL;
mysql> Update user Set Password=password (' New password ') WHERE user= ' root ';
Mysql>flush privileges;
After running, finally remove the My.ini in the Skip-grant-tables, restart mysqld can be.
Method Two:
Do not modify the MySQL password by using the non-service mode plus skip-grant-tables to run MySQL without modifying the My.ini method of restarting the service
Stop MySQL Service
Open a command-line window and start with Mysqld-nt.exe in the bin directory, which is executed at the command-line window: Mysqld-nt--skip-grant-
Tables
Then open a command-line window, log in to MySQL, no need to enter the MySQL password to enter.
After modifying the password as above, close the command line to run the MySQL window, this time the MySQL is turned off, if you find that MySQL is still running
The corresponding process can be closed by closing.
Start the MySQL service
This article is from the "MySQL Basic Notes" blog, reproduced please contact the author!
Reset the password for the root account of MySQL