mysql:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO/YES)

problem

mysql:ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

When entering to mysql -u root -pstart mysql, this error message appears after entering the password, because the password is incorrectly entered

Solution: (The following is based on win10 as an example)

  • 1. You can re-enter the correct password if you know it;
  • 2. If you cannot remember the password, you need to reset the password;
    mysql password reset method
  • 1. Find the my.ini file (at the same level as the bin folder),
    image-20210201230355219
    open the my.ini file, and enter skip-grant-tables at the end to save; it means skip when entering the password
  • 2, the input terminal net stop mysqlclose mysql, and then enter the net start mysqlopen mysql database;
  • 3. Enter mysql -u root -p, directly enter the enter key without entering the password to enter the mysql database editing mode;
  • 4, an input update user set authentication_string=password('新密码') where user='root';reset code;
  • 5, the input flush privileges;refresh;
  • 6 :quit;,, exit;
  • 7. Complete the steps again 2-3and enter the password you set;

Guess you like

Origin blog.csdn.net/weixin_42512684/article/details/113531713