MySQL Error 2006: The mysql server has disappeared
P粉786432579
P粉786432579 2023-08-23 17:47:00
0
2
414
<p>I run a server at my office to process some files and report the results to a remote MySQL server. </p> <p>File processing takes some time and the process terminates midway with the following error: </p> <pre class="brush:php;toolbar:false;">2006, MySQL server has gone away</pre> <p>I've heard about the MySQL setting <strong>wait_timeout</strong>, but do I need to change that on my office server or a remote MySQL server? </p>
P粉786432579
P粉786432579

reply all(2)
P粉478835592

I've encountered this situation many times and usually find the answer is max_allowed_packet.

Raising the value in /etc/my.cnf (under [mysqld]) to 8 or 16M usually fixes the problem. (The default in MySql 5.7 is 4194304, which is 4MB.)

[mysqld]
max_allowed_packet=16M

Note: If the row does not exist, just create the row, it must appear as an entry under [mysqld]

NOTE: This can be set while the server is running, but it will be lost after the mysql daemon is restarted. Use SET GLOBAL max_allowed_packet=104857600 (this sets it to 100MB)

Note: On Windows, you may need to save your my.ini or my.cnf file using ANSI instead of UTF-8 encoding.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!