The MySQL password is correct but cannot be logged on locally.
The MySQL root Password is correct, but you cannot log on to MySQL locally.
Copy codeThe Code is as follows:
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)
Later, the user table in the mysql database was found to be missing a data item whose root points to host: localhost, and only one data item whose root points to host: host Name, therefore, you cannot use the root account to log on to MySQL.
In summary, the root account does not have the account information for accessing the localhost host, resulting in local login failure.
The simulated test is as follows:
So how can I recover the root login?
Here is a record of today's Tangle:
Kill the MySQL process and add it to the mysql startup parameters.
Copy codeThe Code is as follows: -- skip-grant-tables
You can log on to mysql without a password.
Of course, we must also repair the lost data items of the root account.
There are two solutions:
First, the root account has three records at the beginning, including the root account's localhost, hostname, and 127.0.0.1 account data. We can update the host to the localhost of the other two items.
The second method is to directly insert a record, and the host is localhost.
To sum up, even if the root host contains the host name, 127.0.0.1 still cannot be logged on normally. Therefore, you must have the host of localhost.