1130 - Host ‘_gateway‘ is not allowed to connect to this MySQL server 错误解决

今天在使用navicat 绑定自己本地使用docker搭建的宝塔的数据库时出现错误:1130 - Host ‘_gateway’ is not allowed to connect to this MySQL server

解决:使用
xxx:登录用户名
xxxx:登录密码
ps:%可以替换成特定的ip地址

GRANT ALL PRIVILEGES ON *.* TO 'xxx'@'%' IDENTIFIED BY 'xxxx' WITH GRANT OPTION;
错误信息"1130-Host '' is not allowed to connect to this mysql server"表示该主机不允许连接到 MySQL 服务器。出现这个错误的原因通常是没有为该主机授权远程访问 MySQL解决此问题的方法有两种: 1. 改表法:可以在 localhost 的电脑上登录 MySQL,然后更改 "mysql" 数据库中的 "user" 表中的 "host" 项,将其从 "localhost" 改为 "%"。具体操作如下: ``` mysql -u root -p use mysql; update user set host = '%' where user = 'root'; select host, user from user; ``` 2. 授权法:使用 GRANT 语句为指定的用户授权从特定主机连接到 MySQL 服务器。例如,如果你想让用户 myuser 使用密码 mypassword 从任何主机连接到 MySQL 服务器,可以使用以下语句: ``` GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; ``` 如果你想允许用户 myuser 从 IP 地址为 192.168.1.3 的主机连接到 MySQL 服务器,并使用 mypassword 作为密码,则可以使用以下语句: ``` GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; ``` 通过执行上述操作,你可以解决 "1130-Host '' is not allowed to connect to this mysql server" 错误,并允许指定的主机连接到 MySQL 服务器。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [1130, "Host 'xxxx' is not allowed to connect to this MySQL server](https://blog.csdn.net/zd147896325/article/details/82427107)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Host 主机名 is not allowed to connect the mysql server](https://download.csdn.net/download/weixin_38599712/14037862)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [解决ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server 方法](https://blog.csdn.net/xingxu0207/article/details/77870702)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值