Lost connection to MySQL server at 'reading initial communication packet' 错误解决

Lost connection to MySQL server at 'reading initial communication packet' 错误解决

上次解决了这个问题,今天又碰到,突然失忆,又做了一番无用功后终于搞定,这次一定要记录下来,免得下次又浪费时间

1、修改mysql配置文件

vi /etc/my.cnf

[mysqld]段加skip-name-resolve

在这个之前要把mysql的远程访问权限打开,或者再加skip-grant-table(不推荐)

2、修改hosts.allow

vi /etc/hosts.allow

加mysqld : ALL : ALLOW

mysqld-max : ALL :ALLOW

原文地址:https://www.cnblogs.com/joeylee/p/3476744.html