MySQL Error: Too Many Connections or Server Has Gone Away
Database limits or timeouts break pages under load. Find what holds connections.
Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Too many connections
- The account's connection limit is reached, often because of traffic spikes, slow queries or bots.
- Check slow pages and plugins, add caching, block bad traffic. See Bot Attacks and Traffic Floods: What a Small Website Owner Can Do.
- Close connections properly in custom code.
Server has gone away
- A query exceeded max_allowed_packet (large inserts) or the connection timed out.
- Break big writes into smaller ones.
- Ask your host about limits.
Also check
Disk space and database repair. See Repair and Optimize the WordPress Database (Corrupted Tables) and PHP Database Connection Errors (mysqli and PDO): Access Denied, Unknown Database, Connection Refused.
Related guides
- YouTube Video Embed Not Working or Showing an Error on Your Website
- Yoast SEO or Rank Math Sitemap Shows 404 or Is Empty
- WordPress XML Sitemap Gives 404 or Is Not Generating
- Changed the WordPress Address (URL) and Now the Site or Login Is Broken
Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.