How to Fix the Error Establishing a Database Connection in WordPress?

Question

Please help – Error establishing a database connection?

Often when logged into the editor, and trying to access a post to edit, I get the Error establishing a database connection message.

Speaking to my host (GoDaddy) they said I am probably getting this because the max connections are all being used. I have 24 user connections. Max connections is 1,000. They said this should be enough to support over 100k visitors a day. Which I am nowhere near there.

I disabled many plugins and temp changed the theme, but because its sporadic there its difficult to hone in on what is causing this, I also did a database repair of which no errors were found. It does occur daily.

Is there something I can use that can figure out what is gobbling up all the connections so quickly causing the Error establishing a database connection issue.

What else do you recommend that I can I do to diagnose the issue?

Error Establishing a Database Connection

in progress 0
aliakkas38 1 month 4 Answers 96 views 0

Answers ( 4 )

  1. I had a client using GoDaddy Managed Hosting (dislike!!!) and I went through this. To resolve, I created a new DB Username and attached to the same database. As I recall, I had to use FTP (my good ole’ Dreamweaver) to get to wp-config to edit, as a ton of files are blocked for access with managed hosting. I changed the username credentials in wp-config. I also found that despite anything I tried to do in tweaking PHP settings, they don’t actually allow php.ini to configure more memory and max_execution_time…. total pain. it’s possible to get around it by creating a user.ini (be careful that you use a bona fide code editor for this or GoDaddy will not recognize). I then bump up available resources a bit, and I found that helped overall performance. But again, you’ll have to create that file and upload via FTP if it’s the same type of hosting we had to cope with. Ultimately, I also had the client upgrade their hosting resources to the next level so RAM was increased. I appreciate that some people like the insulated bubble of a hands-off managed hosting plan, but when there are SO many sites on the same box and it’s underfed (with a much lower version of PHP and MySQL than is recommended), it’s not the best scenario for those of us who like more granular control.

  2. Hello,

    It’s probably a Database server issue. Are you on a shared MySQL server? Because maybe the server is overloaded by someone else. 1000 is more than enough.

    Since we don’t know what your WP/MySQL server setup is, it’s not obvious to find ways to debug it, but one solution is to move your DB on another server and see what happens.

    • I am on a GoDaddy Managed WordPress right now, that is shared, and as far as I can tell there is no way of moving to a different server unless I ask them, but they are probably going to push back and say its my setup plugins. Is there something that can see what is hitting the DB?

      • If you have access to PHPMySQL you can see if it’s ON or not first. From where you stand, you don’t have visibility on performance etc. Esp if the server doesn’t answer.

        If it’s a managed WP install — it’s THEIR problem to make it work, and analyze any perf issue.

        If not, I’d recommend moving elsewhere

Leave an answer

Browse
Browse