MySQL import local error problem Lost connection to MySQL server during query

The sql file exported from the server database always fails to report an error when importing to the local mysql. The
error code is: 2013 - Lost connection to MySQL server during query

Add max_allowed_packet = 100M under the mysqld node of the my.ini configuration file. Thank you,

mysql according to the configuration The file will limit the size of the packets accepted by the server.

Sometimes large inserts and updates are limited by the max_allowed_packet parameter, causing writes or updates to fail.

View the current configuration

show VARIABLES like '%max_allowed_packet%';

the displayed result is:

+--------------------+---------+

| Variable_name | Value |

+--------------------+---------+

| max_allowed_packet | 1048576 |

+-------- ------------+---------+ 

The above description shows that the current configuration is: 1M



modification method

1. Modify the configuration file

You can edit my.cnf to modify (my.cnf under windows ini), modify it in the [mysqld] section or the server configuration section of mysql.

max_allowed_packet = 20M
If my.cnf can not be found, you can pass

mysql --help | grep my.cnf
to find the my.cnf file.

Under linux, the file is under /etc/.

2. Modify

in the mysql command line Run

set global max_allowed_packet = 2*1024*1024*10 in the mysql command line,
then exit the command line, restart the mysql service, and then enter.

show VARIABLES like '%max_allowed_packet%';
Check whether max_allowed_packet is edited successfully.


Note : If this value is set too small, it will cause a single record to fail to be written to the database after it exceeds the limit, and subsequent record writing will also fail.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326694134&siteId=291194637