问题描述
在进行MySQL数据库的远程连接操作时,出现错误:“ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server”。
分析原因
问题显示为我们无法连接MySQL服务器,显示不被允许,说明没有访问权限。 主要是MySQL服务器端远程连接权限没有对外开放。
登录数据库查看配置;
use mysql;
select host from user where user ='root';
+-----------+
| host |
+-----------+
| localhost |
+-----------+
1 row in set (0.01 sec)
use mysql;
Database changed
update user set host ='%' where user ='root';
Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
Database changed mysql> update user set host ='%' where user ='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
select host from user where user ='root';
+------+
| host |
+------+
| % |
+------+
1 row in set (0.00 sec)