MySQL ERROR 2013 (HY000): Lost connection to MySQL server during query
The connection dropped mid-query — server crash/restart, timeouts, or a proxy cutting long queries.
Seen on:
MySQL
Meaning
Long-running queries exceeding net_read_timeout/proxy timeouts, oversized packets, or the server being OOM-killed.
Common causes
- Server crashed/restarted (OOM)
- Long query hitting net_read_timeout or proxy idle timeout
- Packet larger than max_allowed_packet
⚡ Quick fix
- Check the MySQL error log for crashes
- Raise net_read_timeout / wait_timeout for long jobs
- Optimize the long query
Detailed fix by platform
MySQL
SET GLOBAL net_read_timeout = 600;
How to diagnose
- Server — Restarted?
- Query — Duration?
🧠 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