现在的位置: 首页 > 综合 > 正文

mysql reading initial communication packet

2013年09月11日 ⁄ 综合 ⁄ 共 575字 ⁄ 字号 评论关闭

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

测试服务器上的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注释起来。就可以了!

抱歉!评论已关闭.