If mysql does not support remote connection, the following error code is displayed: error code 1130, ERROR1130: Host * isnotallowedtoconnecttothisMySQLserver,
If mysql does not support remote connection, the following ERROR code is displayed: ERROR 1130: Host * is not allowed to connect to this MySQL server,
There are two methods to solve this problem:
Change localhost to %
Enter the BIN directory of mysql
The code is as follows: |
|
Mysql-u root-p Mysql> use mysql; Mysql> update user set host = '%' where user = 'root '; Mysql> flush privileges; |
Detailed analysis
1. after logging on to mysql on the local machine, change the "host" entry in the "user" table in the "mysql" database to "%" from "localhost '.
The code is as follows: |
|
Mysql> Mysql> use mysql; Mysql> select 'host' from user where user = 'root '; |
# View the host value of the user table in the mysql database (the host/IP name for connection access)
The code is as follows: |
|
Mysql> update user set host = '%' where user = 'root '; |
# Modify the host value (add host/IP addresses with the wildcard % content, or directly add a specific IP address. if ERROR 1062 (23000) occurs when the update statement is executed ): duplicate entry '%-root' for key 'primary' error. select host from user where user = 'root ';
Check whether the host has a value of %. If yes, run the following flush privileges command)
The code is as follows: |
|
Mysql> flush privileges; Mysql> select host, user from user where user = 'root '; Mysql> quit |
Another method
If you are using phpmyadmin, you can log on to phpmyadmin and go to the permission management page. all users are displayed. click modify as the root user, then, change the domain to "%" (note that you must log on as the root user; otherwise, the domain cannot be modified)