---
title: "Lost connection to MySQL server at 'reading initial communication packet' 错误解决"
author: "allenwc"
date: "2010-11-04T14:26:13Z"
tags: ["MySQL"]
categories: ["数据库"]
slug: "lost-connection-to-mysql-server-at-reading-initial-communication-packet"
draft: false
lastmod: "2010-11-04T14:26:13Z"
id: 802758
url: "https://allenwc.iteye.com/blog/802758"
---

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