Host is not allowed to connect to this MySQL server 解决方法
时间:2020-08-17 22:35:49
收藏:0
阅读:106
问题背景
使用 IDEA 连接服务器上的 MySQL 的数据库报错。报错信息为:
ERROR 1130: Host ‘192.168.1.3‘ is not allowed to connect to this MySQL server
解决方案
自身使用方法一就解决了问题,方法二没有尝试。
- 改表法
mysql> use mysql; mysql> update user set host = ‘%‘ where user = ‘root‘; mysql> FLUSH PRIVILEGES;
- 授权法()
如果你想myuser使用mypassword从任何主机连接到mysql服务器:
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码:GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.1.3‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
参考
- [1] is not allowed to connect to this MySQL server
- [2] Host is not allowed to connect to this MySQL server解决方法
原文:https://www.cnblogs.com/wuminda/p/13520164.html
评论(0)