链接mysql时:Host 'gateway' is not allowed to connect to this MySQL server;

mysql> use mysql;
Database changed
mysql> select 'host' from user where user='root'
    -> ;
+------+
| host |
+------+
| host |
+------+
1 row in set (0.00 sec)

mysql> update user set host = '%' where user ='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> select 'host'   from user where user='root';
+------+
| host |
+------+
| host |
+------+
1 row in set (0.00 sec)

mysql> select 'host'  from user where user='root';
+------+
| host |
+------+
| host |
+------+
1 row in set (0.00 sec)

按以上步骤操作后,重新链接,亲测成功.

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐