Mysql forgot database password

            How to modify the forgotten MySQL password under windows

1. Close the running Mysql service:

   A. Run net stop mysql under the command  

   B. Find the mysql service and stop the mysql service

   C. End the Mysql process in the task manager

2. Open the command line and go to the Bin directory of Mysql

  C:\Users\Administrator>cd C:\Program Files\MySQL\MySQL Server 5.5\bin

3. Skip login verification

Input: mysqld -nt --skip-grant-tables, then press Enter, if there is no error message, it is fine;
Note: After the skip-grant-tables parameter is used, the login verification can be skipped;

4. Other operations

Open another command line (because the DOS window just now cannot be moved), and also go to the bin directory of mysql;

mysql and press enter, if successful, a MySQL prompt will appear >

5. Switch to the user table of Mysql

 Execute: USE mysql;

 修改密码:UPDATE user SET password=PASSWORD("123456") WHERE user="root";   

6. Refresh permissions      

  FLUSH PRIVILEGES;

end!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325023860&siteId=291194637