DBAtlas · Database operations atlas

2006: MySQL server has gone away

MySQL

What 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.

Open in DBAtlas →

More from this engine