Tag Archives: Mysql error 2013

[How to Solve] Lost connection to MySQL server at ‘reading i…

When connecting to a MySQL remote host through TCP/IP, error 2013 (HY000): lost connection to MySQL server at ‘reading initial communication packet’, system error: 104 appears.

 

If you directly type MySQL in the Linux shell command line, you can connect to MySQL smoothly and execute the query statement normally, but if you execute stop slave; The problem of error 2013 (HY000): lost connection to MySQL server during query appears at random. If you write the operation command to the script file and then execute the script file, there will be lost connection to MySQL server at ‘reading initial communication packet’, system error: 111

 

If there are errors in remote access by any means, it can be considered that the system has firewall restrictions, but now this strange cramp phenomenon makes people puzzled. The final solution is to add a startup parameter in the [mysqld] section of my. CNF

 

skip-name-resolve

 

The problem disappears. But I can’t figure out why

The reason is that I set skip name resolve in my.cnf, and skip name resolve is to disable DNS resolution, so I can’t use the host name in the authorization table of MySQL, I can only use IP

Mysql import Error Code: 2013 – Lost connection to MySQL server during query

First view Win + R, call out services.msc and open the service dialog box

Search for MySQL services, right-click — > Property to view the path of the INI file of MySQL

It’s easy to find the wrong place without using the service to search the MySQL execution file path. I found a mydefault.ini file last time, and the result was wrong

Search for “Max” under the file_ allowed_ “Packet”, add in the search section:

lower_case_table_names = 1
wait_timeout=2880000
interactive_timeout = 2880000
max_allowed_packet = 50M

If there is a function in the imported SQL file, an error may be reported:

This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de….

This function is executed in SQLYOG:

set global log_bin_trust_function_creators=TRUE;