今天在使用Navicat连一个远程mysql时,总是提示连接不成功,提示Lost connection to MySQL server at 'reading initial communication packet
但mysql服务已经启动
百度查之,终于找到解决方法如下:
修改hosts.allow
vi /etc/hosts.allow#加mysqld : ALL : ALLOWmysqld-max : ALL :ALLOW
再次连接,但又提示can't connect to mysql server on 'localhost',再次百度查之,得出下面结论:
在my.ini中没有bind-address = 127.0.0.1的参数
但在服务器上查了半天都没找到my.ini文件。
再次查看mysql日志:
里面这这么一段:
151213 17:05:35 InnoDB: 5.5.37 started; log sequence number 16568257151213 17:05:35 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306151213 17:05:35 [Note] - '0.0.0.0' resolves to '0.0.0.0';151213 17:05:35 [Note] Server socket created on IP: '0.0.0.0'.151213 17:05:35 [Note] Event Scheduler: Loaded 0 events
忽然大悟,直接在Navicat中改变连接属性:
连接成功
参考资源:
1、http://blog.sina.com.cn/s/blog_4cd14afb01012eox.html
2、http://blog.csdn.net/chengwenyao18/article/details/24112997