MySQL:reading initial communication packet problem solving

  • 2020-05-13 03:41:14
  • OfStack

Solution 1:

After checking my.cnf, it was found that the setting of innodb_buffer_pool_size = 2048M was too large, so it was adjusted to innodb_buffer_pool_size = 1024M. There are other solutions to this problem on the Internet, but none of them can solve my problem.

Lost connection to MySQL server at 'reading initial communication packet' error resolved

I solved this problem last time, and now I encounter it again. I suddenly lose my memory, and finally get it done after another futile effort. This time, I must write it down, so as not to waste time next time

1. Modify the mysql configuration file

vi /etc/my.cnf

[mysqld] section plus skip name -- resolve

Before you do this, turn on remote access for mysql, or add skip-grant-table (not recommended)

2. Modify hosts.allow

vi /etc/hosts.allow

Plus mysqld: ALL: ALLOW
mysqld-max : ALL :ALLOW

Other comments:

mysql tutorial 'reading initial communication packet' error resolution

This is when the server suddenly shuts down.
The error is:

Unable to link to database tutorial (mysql) server, please check server address, user name, password.
Code: 2013
Error: lost connection to mysql server at communication pa(www.ofstack.com)cket', system error: 0

So let's look at the solution

Method 1: the solution is to add one boot parameter, skip-name-resolve, to the [mysqld] section of my.cnf
Method 2: if method 1 doesn't work, try reinstalling mysql server and then exporting the database to ok.

Conclusion:

If we can get the machine right without reinstalling mysql, that would be the best. Please do not reinstall mysql in case of emergency


Related articles: