1130 -Host 'ip' is not allowed to connect to this MySQL server

 

 由于mysql默认不允许其他IP地址(非虚拟机)访问

可以将访问的用户(如root)的host 由localhost(本机)改成%(任意,也可指定ip)

最后flush privileges刷新权限

 

[root@hadoop4 ~]# mysql -uroot -p

mysql> use mysql;

mysql> select host,user from user;
+-----------+------+
| host | user |
+-----------+------+
| 127.0.0.1 | root |
| ::1 | root |
| hadoop4 | root |
| localhost | root |
+-----------+------+
4 rows in set (0.01 sec)

mysql> update user set host='%' where user='root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'

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

mysql> select host,user from user;
+-----------+------+
| host | user |
+-----------+------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
| hadoop4 | root |
+-----------+------+
4 rows in set (0.00 sec)

 

posted @   yappleorange  阅读(76)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示