2006 MySQL Origin: Data Last updated 14 Oct 2026

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.

Exact message you may see MySQL server has gone away2013 Lost connection to MySQL server during query
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

  1. Raise max_allowed_packet (e.g. 64M) for big imports
  2. Reconnect on failure in long-running workers
  3. Check server logs for crashes

Detailed fix by platform

MySQL

  1. my.cnf: [mysqld] max_allowed_packet=64M; restart.

How to diagnose

  1. Size — Large query/packet?
  2. Idle — Connection idle long?
  3. Server — Restart/crash in logs?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1045 — MySQL ERROR 1045 (28000): Access denied for user (MySQL)10451049 — MySQL ERROR 1049 (42000): Unknown database 'x' (MySQL)10491153 — MySQL ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes (MySQL)11532002 — MySQL ERROR 2002 (HY000): Can't connect to local MySQL server through socket (MySQL)20022003 — MySQL ERROR 2003 (HY000): Can't connect to MySQL server on 'host:3306' (111) (MySQL)20032013 — MySQL ERROR 2013 (HY000): Lost connection to MySQL server during query (MySQL)2013Communications link failure — com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure (Java)Communications link f…connection closed — server closed the connection unexpectedly — This probably means the server terminated abnormally before or while processing the request. (PostgreSQL)connection closed2006

Explore the map of this error Full error map →

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

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.