1. Open the first cmd window, switch to the bin directory of mysql, and run the command:
mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini" --console --skip- grant-tables
2. Open the second cmd window and connect to mysql:
enter the command:
mysql -uroot -p
appears:
Enter password: Enter
directly here without entering a password.
Then there will be a successful login information,
use the command:
show databases;
use the command to switch to the mysql database:
use mysql;
use the command to change the root password:
UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
Refresh permissions:
FLUSH PRIVILEGES;
then log out and log in again:
quit
Log in again:
mysql -uroot -p
A password prompt appears, enter a new password to log in:
Enter password: ***********
Display login Message: All is ok if successful
The solution to forget the root password of mysql under Windows (transfer)
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326780595&siteId=291194637
Recommended
Ranking