MySQL ERROR 2006 (HY000): MySQL server has gone away
The connection to MySQL was closed — usually by a timeout or a packet larger than max_allowed_packet.
Seen on:
MySQL
Meaning
The server dropped the connection: idle longer than wait_timeout, query/packet too big, or the server restarted/crashed.
Common causes
- Long-idle persistent connection exceeded
wait_timeout - Large INSERT/BLOB bigger than
max_allowed_packet - Server crashed or was restarted (OOM)
- Long-running worker reusing an old connection
⚡ Quick fix
- Raise
max_allowed_packet(e.g. 64M) for big imports - Reconnect on failure in long-running workers
- Check server logs for crashes
Detailed fix by platform
MySQL
- my.cnf:
[mysqld] max_allowed_packet=64M; restart.
How to diagnose
- Size — Large query/packet?
- Idle — Connection idle long?
- Server — Restart/crash in logs?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026