problem
mysql:ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
When entering to mysql -u root -p
start 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),
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 mysql
close mysql, and then enter thenet start mysql
open 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-3
and enter the password you set;