I know you have probably come across many a member here who complains of the following error:

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at myamazingsite.com:3306. This could mean your host’s database server is down.

I promise I have not committed the following two mistakes/errors/deadly sins:

  1. My DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, DB_CHARSET, and DB_COLLATE are correct with the proper credentials.
  2. My WP_HOME and WP_SITEURL are commented out in the config file, but my entries in the DB regarding the domain name (in wp_options, wp_blogs, etc.) all match the domain name routed to my server. They all include the protocol (https://) as or as not required - yes in wp_options no in wp_blogs, as an example.

So, it's not a credential issue. Furthermore, I know this because it is intermittent - it occurs once about every 10 requests to my WordPress, just testing it myself. But it's happening to my clients as they browse the site occasionally, and obviously that is not acceptable.

I've read elsewhere this means it's a server load issue, because it occurs only occasionally. But I don't think so, at least not in this case. All my resource utilization on the application server and the DB server both are very low. Traffic is also pretty low, no more than 3 concurrent requests a second.

So maybe it was a network issue? No. I pinged the DB server from the application server over 100 times in succession using nping and the ping never failed with 100% success rate on that test. Furthermore, other applications on the server (non-WordPress) don't have an issue connected to the same DB server.

So what could it be? I'm out of ideas. 😢 It must be another WordPress specific bug/tip/trick that I am unaware of. Please help me!

1 Answer 1


I would look into DB connections issues. There is a specific number of DB connections allowed - a setting in the database config (don't recall which one) - and if there are too many connections, the next connection will fail.

Contact your hosting place and ask them to increase the number of allowable database connections. It's a setting they have to make, at least at my hosting place; I didn't have access to the DB config files.

They might want you to upgrade to a dedicated server, rather than a shared server - that resolved a similarissue for me, although I never thought that the site was that busy to need a dedicated server.

My similar (I think) issue was very hard to diagnose, though, so perhaps the 'you need a dedicated server was just an up-sell.)

  • Thanks for your answer! But no, I don't think this is it. It's not a lot of connections. I'm using AWS and I don't believe they throttle like that as some more managed hosts do - all the utilization metrics are low. Often if I refresh right away then the error goes away too before coming right back. The most action my DB has ever seen was on the ping test, which came back 100% success.
    – Søren
    Aug 1, 2019 at 3:46
  • I spoke too soon! There is a limit - 312 concurrent connections for my DB. It's never had anywhere close to that many simultaneous connections though. 😥
    – Søren
    Aug 1, 2019 at 3:52
  • Still might be hitting the concurrent connections limit. One page request may have several connection requests; depending on how the theme and plugins are built. The hosting place should be able to monitor/see your concurrent connections count over a time period. Perhaps that will give you some info. It was hard for me to diagnose that error on one of my sites. Aug 1, 2019 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.