Tag Archives: Error Code: 2006 – MySQL server has gone away

Error Code: 2006 – MySQL server has gone away

What are the eight life cycle hook functions of Vue>>>

Copyright notice: please indicate the original address https://blog.csdn.net/u013032788/article/details/46564257

The reason for this problem is that the file is too large when importing data

Solutions:
1

1. For Linux system, find the configuration file my.cnf and modify it to a larger value in [mysqld]:

max_ allowed_ packet=6000000M

wait_ timeout=600000

interactive_ timeout = 600000

(it means that the maximum allowable packet size is 16m, and the waiting time-out/activity failure time is 600000 seconds)

2. If it is a Windows system, the general configuration file is my.ini

3. If the configuration file cannot be found, you can run the following statement:

SET GLOBAL max_ allowed_ packet=6000000;

4. Remember to restart mysql

============================================================================

Let’s learn and grow together

Program development group Linux, C: 368848856
Shanghai web development group PHP/ASP: 452703835 (beginner)
verification information: second in charge

Sqlog recovery database error solution [error code: 2006 – MySQL server has gone away]

 

SQLyog is reporting an error when importing the database

Error Code: 2006 – MySQL server has gone away

The max_allowed_packet (a MySQL parameter) is not set to a large enough value.

Then I’ll change it.

In Windows:

In the MySQL server installation directory,
in my.ini file, add the following line under [mysqld] in SERVER SECTION.

max_allowed_packet = 16M

In Linux:

Copy the my-xxx.cnf file from /usr/share/mysql to /etc as my.cnf

xxx can be small, medium, large, huge … depending on the requirement.

$ cp /usr/share/mysql/my-xxx.cnf /etc/my.cnf

In the my.cnf file, change the default
max_allowed_packet = 1M
to
max_allowed_packet = 16M

Save the file and restart MySQL server.

Today, when importing .sql files, I got Error Code: 2006 – MySQL server has gone away error, it turns out that the imported sql file is larger than the default max_allowed_packet value of the system. I found the my.cfg file and modified other files, so I used the sql statement to modify it directly.

SET GLOBAL max_allowed_packet=67108864;

This is quite good, no need to restart the service after the change, it works directly