快速解决mysql Lost connection to MySQL server at 'reading initial communication packet及can't connect to mysql server on 'localhost',

今天用heidsql连接mysql时出了问题,提示:Lost connection to MySQL server
at ‘reading initial communication packet

今天用heidsql连接mysql时出了问题,提示:Lost connection to MySQL server
at ‘reading initial communication packet

快速解决mysql Lost connection to MySQL server at ‘reading initial communication packet及can’t connect to mysql server on ‘localhost’,

今天在使用Navicat连一个远程mysql时,总是提示连接不成功,提示Lost
connection to MySQL server at ‘reading initial communication packet

但mysql服务已经启动

百度查之,终于找到解决方法如下:

修改hosts.allow

vi /etc/hosts.allow
#加mysqld : ALL : ALLOW
mysqld-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 16568257
151213 17:05:35 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
151213 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

连接成功

 

参考资源:

1、

2、

Lost connection to MySQL server at
reading initial communication packet及cant connect to mysql server on
localhost, 今天在使用Navicat连一个远程mysql时…

网上搜索了答案,都说要修改配置文件。。但是没有找到怎么办。。

网上搜索了答案,都说要修改配置文件。。但是没有找到怎么办。。