mysql error 1130 hy000:Host'localhost' solution

  • 2020-05-14 05:06:52
  • OfStack

ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server www.ofstack.com

Reasons:
mysql only has 1 root user. After changing root password, MD5 is selected
"Host 'localhost' is not allowed connect to this MySQL server..."
Try another user table in the mysql library, overwrite, no, probably a different version
Solution:
Edit my ini

Add a sentence to the [mysqld] paragraph: skip-grant-tables

Such as:
Java code
 
[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
skip-name-resolve 
skip-grant-tables 

The purpose is to:

Bypassing the access control of MySQL, anyone can access the MySQL database from the console as an administrator.

It is important to note that the MySQL server will not take effect until it is stopped and restarted after the password has been changed

Restart the mysql service!

Related articles: