2006: MySQL server has gone away
MySQLWhat does it mean?
The connection between client and server was lost during a command. The server may have closed the connection or rejected the packet.
Why does it happen?
An idle connection closed because wait_timeout/interactive_timeout expired, a query/data larger than max_allowed_packet, a server restart or crash, or a network outage.
How to fix it
For idle connection issues, use validation in the connection pool and review wait_timeout. If you send large data, increase max_allowed_packet (e.g. SET GLOBAL max_allowed_packet = 64*1024*1024, my.cnf to persist). Check the server logs for restarts/crashes and OOM traces. Add reconnect logic in the application for dropped connections.
More from this engine
- 1054Unknown column in field list
- 2002Can't connect to local MySQL server through socket
- 2003Can't connect to MySQL server (TCP/IP)
- 1114The table is full
- 1215Cannot add foreign key constraint
- 1451Cannot delete or update a parent row: a foreign key constraint fails
- 1452Cannot add or update a child row: a foreign key constraint fails