Solve remote connection mysql error 1130

Solve remote connection mysql error 1130

 

Remotely connect to the database of Mysql server, the error code is 1130, ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server  

The guess is that it is a problem of user permissions that cannot be given to the remote connection. 

This can be solved by operating the mysql library in this way. 

 

After logging in to mysql locally, change the "host" item in the "user" table in the "mysql" database, and rename it from "localhost" to '%' 

mysql -u root -p  

mysql;use mysql;  

mysql;select 'host' from user where user='root';  

mysql;update user set host = '%' where user ='root';  

mysql;flush privileges;  

mysql;select 'host'   from user where user='root'; 

 

 

The first sentence: log in as the privileged user root  

The second sentence: select the mysql library  

The third sentence: View the host value of the user table in the mysql library (the host/IP name for connection access)  

The fourth sentence: Modify the host value (add the host/IP address with the wildcard % content), of course, you can also directly increase the IP address  

If there is an error in this step, "ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'" means that the record exists, skip this step

The fifth sentence: Refresh the MySQL system privilege related table  

The sixth sentence: When re-checking the user table, there is a modification. .  

Restart the mysql service to complete. 

Guess you like

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