Error Nr. 1045 Access denied for user 'root'@'localhost' (using password: YES)

MySql error 1045 Access denied for user 'root'@'localhost' (using password:YES) solution under windows (forgot password)

 

1. Enter the administrator console to stop the mysql service: net stop mysql;

 

2. Enter the installation path of mysql, such as my installation path is C:\Program Files\MySQL\MySQL Server 5.5, open the my.ini file, find [mysqld], add skip_grant_tables under this line, that is, notify mysql, in Skip the password verification when logging in, save and exit;

 

3. Restart the mysql service: net start mysql;

 

4. Enter in the console: mysql -u root -p When the password pops up, you only need to press Enter to enter mysql;

 

5. To reset the password of user root, enter: UPDATE user SET Password=PASSWORD('your new password') where USER='root';

 

6. Exit mysql and enter: quit;

 

7. To stop the mysql service, enter: net stop mysql in the administrator console;

 

    Delete the skip_grant_tables line just added in the C:\Program Files\MySQL\MySQL Server 5.5\my.ini file;

 

  After saving, restart the mysql service and enter: net start mysql;

 

8. Log in with the new password.

Guess you like

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