ERROR 1130 (HY000): Host 'LAPTOP-MBE7SAI0.lan' is not allowed to connect to this MySQL server
时间: 2023-12-23 16:59:07 浏览: 85
当你遇到错误`ERROR 1130 (HY000): Host 'LAPTOP-MBE7SAI0.lan' is not allowed to connect to this MySQL server`时,这意味着你的MySQL服务器不允许来自`LAPTOP-MBE7SAI0.lan`主机的连接。这通常是由于MySQL的系统数据库`mysql`中的`user`表没有为该主机配置登录信息导致的。
为了解决这个问题,你可以按照以下步骤进行操作:
1. 使用root用户登录MySQL所在的主机。
2. 在命令行中输入以下命令以登录MySQL系统数据库:
```
mysql -u root -p
```
3. 进入数据库`mysql`:
```
use mysql;
```
4. 授权具有全部权限的用户给`LAPTOP-MBE7SAI0.lan`主机登录MySQL,并设置密码:
```
grant all privileges on *.* to 'your_username'@'LAPTOP-MBE7SAI0.lan' identified by 'your_password' with grant option;
```
注意将`your_username`替换为你的用户名,将`your_password`替换为你的密码。
5. 如果你希望允许该用户从任意主机登录MySQL,可以将`LAPTOP-MBE7SAI0.lan`替换为`%`:
```
grant all privileges on *.* to 'your_username'@'%' identified by 'your_password' with grant option;
```
6. 更新用户权限为`%`:
```
update user set host='%' where user = 'your_username';
```
7. 最后,刷新MySQL的权限:
```
flush privileges;
```
完成上述步骤后,你应该能够使用Navicat或其他工具连接到MySQL服务器了。请确保替换`your_username`和`your_password`为你的具体用户名和密码。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [MYSQL不能从远程连接的一个解决方法(s not allowed to connect to this MySQL server)](https://download.csdn.net/download/weixin_38657457/13695718)[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* [MySQL登录报错1130:1130 Host ***.***.***.*** is not allowed to connect to this MySQL server](https://blog.csdn.net/baidu_28122193/article/details/131558216)[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 (HY000): Host XXX is not allowed to connect to this MySQL server(解决连接远程数据库报错...](https://blog.csdn.net/arlenliuwei/article/details/127025879)[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 ]
阅读全文
相关推荐












