Access denied for user'root'@'localhost' (using password:YES) when connecting to mysql

This situation appears as shown in the figure:
weimingchao
Reason 1 : The password is entered incorrectly!

Think carefully about what your password is and try a few more times. If you can’t get up first, re-run the MySQL repair tool and reset the password

Reason 2 : The root account does not open remote access permissions by default
. You need to modify the relevant permissions.

解决方案:

1. Open the my.ini file under the MySQL directory (mine is C:\Program Files (x86)\MySQL\MySQL Server 5.5), edit it, add a line "skip-grant-tables" at the end of the file, save and Close the file. Some put the my.ini file in the hidden Program data file for safety.
2. Open the service and restart the MySQL service.

Reason three : mysql server stops

Restart the MySQL service:net start mysql

My question: Forgot password

It’s very normal to forget your password if you don’t use MySQL for a long time. So, any study and work must be backed up and recorded. Maybe one day your database will fall.

Guess you like

Origin blog.csdn.net/m0_46202060/article/details/109735275