Access denied for user 'root'@'localhost' (using password:YES) solution

Access denied for user 'root'@'localhost' (using password:YES) Solution
Solution:
1. Open the my.ini file in the MySQL directory, add a line of "skip-grant-tables" at the end of the file, save and Close the file.
2. Restart the MySQL service.
3. Enter "mysql -uroot -p" in the command line (without entering a password), and press Enter to enter the database.
4. Execute, "use mysql;" to use the mysql database.
5. Execute, "update user set password=PASSWORD("rootadmin") where user='root';" (modify root's password)
(During the period, I also selected the records in the user table, and some garbled characters were displayed when querying all , and then I only queried the Host, User, and Password fields in the user table. It seems that there were 3 records displayed at that time, and 1 of them had no name. Of course, in order to solve the problem, I can't control these.)
6. Open the MySQL directory my.ini file below, delete the last line "skip-grant-tables", save and close the file.
7. Restart the MySQL service.
8. Enter "mysql -uroot -prootadmin" in the command line, the problem is solved!

Guess you like

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