mysql reading initial communication packet

刚解决了一个小问题,在此记录一下。

测试服务器上的mysql,当我在本地使用工具去连接它的时候,报错:Lost connection to MySQL server at 'reading initial communication packet'

我首先想到的是要在服务器上给所有IP授权,于是在服务器上使用命令登录mysql,并执行:

grant all privileges on dbname.* to 'username'@'%' identified by 'passed'

其中,%号表示允许所以IP访问。


到本地试着连接一下还是不行。

然后我继续做其它尝试的时候,在错误提示了看到一句话:请确定mysql中是否去掉了skip-networking的设置。我打开mysql的配置文件:

vi /etc/mysql/my.cnf

注意到下面的内容:

# Instead of skip-networking the default is now to listen only on 
# localhost which is more compatible and is not less secure. 
bind-address           = 127.0.0.1 # Instead of skip-networking the default is now to listen only on


原来是这里做了绑定,我把bind-address注释起来。就可以了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值