mysql 允许客户端连接_如何允许远程客户端连接MySQL服务器

14098ec8558592bebe99d45504716743.png

在尝试从客户端系统连接远程mysql服务器时,我们经常遇到下面的问题,远程客户端不允许访问这个mysql服务器,如下所示。# mysql -h 192.168.1.10 -u root -pEnter password:[Output]ERROR 1130 (HY000): Host '192.168.1.12' is not allowed to connect to this MySQL server

这个问题是因为,如果客户机系统没有连接mysql服务器的权限。默认情况下,mysql服务器不允许任何远程客户端连接。

(相关推荐:MySQL教程)

允许MySQL客户端连接:

允许客户端系统连接mysql服务器。先使用ssh登录远程mysql服务器,然后在本地登录mysql服务器。现在使用以下命令来允许远程客户端。例如,如果远程客户端的IP是192.168.1.12,并尝试通过MySQL root帐户进行连接。

[以下命令需要在mysql服务器上运行]# mysql -u root -pEnter password:mysql> GRANT ALL ON *.* to root@'192.168.1.12' IDENTIFIED BY 'new-password';mysql> FLUSH PRIVILEGES;mysql> quit

已在MySQL服务器中成功创建新帐户以从指定的客户端系统进行连接。

让我们尝试从客户端系统连接。# mysql -h 192.168.1.10 -u root -p[Sample Output] Enter password:Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 27Server version: 5.1.69 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.mysql>

本篇文章到这里就已经全部结束了,更多其他精彩内容可以关注php中文网的其他相关栏目教程!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值