mysql Remote connection problems: Lost connection to MySQL server at ‘reading initial communication packet’, syste…

When using Navicat for MySQL to remotely connect to MySQL, there is a problem

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

It’s disgusting. The server was rebooted once, and it was dealing with all kinds of MySQL problems all morning

Two methods were tried, but they didn’t work

Modify my.cnf file (my.ini for Windows)

Generally, it is in the installation directory of MySQL,/etc/mycnf

Add skip name resolve in the [mysqld] zone of my.cnf configuration file. What netizens say is to skip the DNS reverse resolution function of MySQL connection, which can improve the performance of MySQL. In this case, you can only use the IP in the MySQL authorization table to connect to the MySQL service

But it doesn’t work. Several parameters of my.cnf configuration are attached:
skip name resolve skips the DNS reverse resolution process. (in this way, you can’t use the host name to connect to MySQL, you can only use the IP connection)
skip grant tables skips the authorization table (the solution when the MySQL login password is forgotten)
skip networking skips the TCP/IP connection
skip host cache disable the host name cache; To clear the host name cache, execute the flush hosts statement or the mysqladmin flush hosts command

write the IP address of the client in the/etc/hosts file of the MySQL server, and do the host mapping for any name

Because the working environment needs to access MySQL at multiple addresses, it is unrealistic to maintain the hosts file all the time, so it is eliminated

It turns out that
remote access to MySQL is OK, but not local access, which means that you can run in the production environment as usual. It’s disgusting

Similar Posts: