👋
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:
- My
DB_NAME
,DB_USER
,DB_PASSWORD
,DB_HOST
,DB_CHARSET
, andDB_COLLATE
are correct with the proper credentials. - My
WP_HOME
andWP_SITEURL
are commented out in the config file, but my entries in the DB regarding the domain name (inwp_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 inwp_options
no inwp_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!