Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of some common causes of MySQL server has gone away errors

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The most common cause of MySQL server has gone away is that the connection is idle and timed out and the connection is interrupted by the server. By default, the server closes connections that have been idle for more than 8 hours. You can change the default value of 8 hours by setting the variable wait_timeout, and you also need to modify interactive_timeout.

Wait_timeout: the number of seconds the server waits for activity before closing a non-interactive connection.

Interactive_timeout: the number of seconds the server waits for activity before closing the interactive connection

The MySQL command line is reconnected by default, but some applications do not have a reconnection mechanism, which often leads to execution failure.

Some other reasons for MySQL server has gone away errors are as follows:

(1)。 Use the KILL command or the mysqladmin kill command to kill the running thread

(2)。 Attempt to run the query after closing the connection to the server

(3)。 Encountered a TCP/IP connection timeout error on the client side

(4)。 Encountered a timeout error on the server side and disabled the automatic connection mechanism in the client side

(5)。 This kind of problem can also be encountered if an incorrect or overly large query is issued to the server, and if mysqld receives an overly large or disordered packet, it will assume that the client has made an error and close the connection. If you need to execute a larger query, you can set the server's max_allowed_packet

Variable to increase the query limit value, the default value of this variable is 1MB.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report