mysql远程连接问题 Lost connection to MySQL server at ‘reading initial communication packet', system e

Posted tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql远程连接问题 Lost connection to MySQL server at ‘reading initial communication packet', system e相关的知识,希望对你有一定的参考价值。

在用Navicat for mysql远程连接mysql的时候,出现了

Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 0

好恶心,服务器重启了一次,就一上午都是在处理mysql的各种问题。

试了两种方法都不生效:

修改my.cnf文件(windows为my.ini)

一般在mysql的安装目录,/etc/mycnf。

在my.cnf配置文件中的[mysqld]区域添加skip-name-resolve,看网友说的是跳过mysql连接的DNS反向解析功能,这样能很好地提高mysql性能。在这种情况下,就只能使用MySQL授权表中的IP来连接mysql服务了。

但是不生效。附上my.cnf配置的几个参数:
skip-name-resolve         跳过DNS反向解析过程.(这样就不能使用主机名连接mysql了,只能使用ip连接)
skip-grant-tables           跳过授权表(当mysql登陆密码忘记时的解决办法)
skip-networking             跳过TCP/IP连接
skip-host-cache             禁用主机名缓存;要想清除主机名缓存,执行FLUSH HOSTS语句或执行mysqladmin flush-hosts命令

把client的ip写在mysql服务器的/etc/hosts文件里,随便给个名字做主机映射即可。

因为工作环境需要在多个地址访问mysql,一直维护hosts文件也不现实,所以被淘汰。。。

 

 

 

 

最后发现。。。。。。
远程访问mysql都可以,就是本地访问不了,也就是说可以照常在生产环境跑。真恶心

 






以上是关于mysql远程连接问题 Lost connection to MySQL server at ‘reading initial communication packet', system e的主要内容,如果未能解决你的问题,请参考以下文章

MySQL报错解决方案:2013-Lost connection to MySQL server

MySQL报错解决方案:2013-Lost connection server at ‘waiti

Can not connect to database! error: Lost connection to MySQL server at 'reading initial co

mysql Lost connection to MySQL server at ‘reading initial communication packet

Mysql连接错误:Lost connection to Mysql server at 'waiting for initial communication packet'(示例代码

Mysql连接在节点js中一段时间​​后关闭并给出PROTOCOL_CONNECTION_LOST'