MySQL Error 2006
MySQL Error 2006 MySQL Server Has Gone Away Error
What This Error Means
MySQL Error 2006 'MySQL server has gone away' means the connection to the database was lost during a query. This is different from a connection failure; the connection existed but died.
Common Causes
- The query was too large (exceeding `max_allowed_packet`).
- The server timed out the connection (exceeding `wait_timeout`).
- The MySQL server crashed or was restarted.
- Network glitch between PHP and MySQL server.
How to Fix It (For Users)
- 1 Refresh the page.
- 2 Wait a few minutes if the server is restarting.
For Site Owners / Developers
- Increase `max_allowed_packet` in `my.cnf`.
- Increase `wait_timeout` for long-running scripts.
- Check MySQL error logs for crashes.
- Optimize large queries to send less data.
When It Is NOT Your Fault
If the database server crashed due to a bug.
Is the website actually down?
Sometimes the issue is just on your end. Check if the website is down for everyone or just you.
Check Website Status →Recommended Tool to Prevent This Error
Prevent server timeouts and resource exhaustion with scalable cloud infrastructure.