Host ' xxx ' is not a allowed to connect to this MySQL server.
MySQL Open remote connection
Today in the server installed MySQL, ready to use Mysqlguitools remote login error, prompt: Host ' xxx ' is not allowed to connect to this MySQL server. Found some information on the Internet, is MySQL does not open MySQL remote access rights caused.
Document the solution for future reference. :
1. Log in to Mysql:mysql-uroot-ppwd
2. View the user table:
mysql> use MySQL
Database changed
mysql> Select Host,user,password from user;
+------+------+-------------------------------------------+
| host | user | password |
+------+------+-------------------------------------------+
| localhost | root | *826960fa9cc8a87953b3156951f3634a80bf9853 |
+------+------+-------------------------------------------+
1 row in Set (0.00 sec)
The host and User fields in the table identify the hosts and users who can access the database. For example, the above data means that the local host can only be accessed by the root user. So it's no wonder that remote connections are not connected.
To enable the database to support remote host access, there are two ways to turn on remote access functionality.
The first (change the table method):
Modify the value of the host field to change localhost to an IP address that requires a remote connection to the database. or directly modified to%. Modification to% means that all hosts can access the database through the root user. For convenience, I directly modified into%. Command:mysql> Update user set host = '% ' where user = ' root ';
View the user table again
| Host | user | password |
|% | root | * 826960fa9cc8a87953b3156951f3634a80bf9853 |
1 row in Set (0.00 SEC)
The modification succeeds, the input command mysql> FLUSH privileges; Enter to make the previous modification effective, and then connect the database remotely successfully.
The second type (Authorization law):
For example, if you want root to connect to a MySQL server from any host using MyPassword.
GRANT all privileges on * * to ' root ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;
If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.3 and use MyPassword as the password
GRANT all privileges on * * to ' root ' @ ' 192.168.1.3 ' identified by
' MyPassword ' with GRANT OPTION;
Enter the command mysql> FLUSH privileges; Enter to make the previous modification effective, and then connect the database remotely successfully. Bingo.
Don't forget the final flush privileges; Refreshes the previous modification.
MySQL Open remote connection