InMotion Hosting Support Center

While the "Error Establishing a Database Connection" is a fairly common error, troubleshooting it can take a few different routes. This article will explain the error and go over the different causes and fixes.

What is the "Error Establishing a Database Connection" error?

This error means that your Wordpress script either cannnot locate the database, or is being refused the ability to connect to the database.

What causes this error?

This error can occur due to a few different causes, each one is described along with recommended solution.

Incorrect connection parameters

By far the most common, having incorrect connection credentials will cause the error. These credentials are located in the wp-config.php file found in the root folder for your WordPress installation. There are three credentials: database name, database user, and password. Make sure these match the information located in your cPanel. If you know the current database user password, you can reset it. If you do not know it, you will not be able to view the current password, so you will need to delete and then recreate the database user, giving it the password found in the wp-config.php file. If this is the issue, then the problem should be solved and the site should display normally

Corrupted database tables

If you have confirmed the credentials are correct and still get the error, the issue could be caused by corrupted database tables. Database tables can be checked and repaired from within the cPanel. Follow the instructions from our article below to perform the repair.

Too many concurrent database connections

The error can also occur if there are too many connections to your database at once. Currently, the default limit for our servers is 30 connections at once. If this is your issue, you can certainly curb it by enabling caching plugins on your website. This will limit the overall number of database interactions your Wordpress site performs.

We have several articles to assist you with this. These are listed below.

Additionally, there can be other causes for extraneous database interaction. These can be prevented by logging out of WordPress admin dashboard when not in use, disabling the WordPress autosave, and limiting or disabling WordPress revisions.

Was this article helpful?
Continued Education in Course WordPress
You are viewing Section 31: 343: Wordpress - "Error Establishing a Database Connection"
Section 30: 344: Moving a WordPress Installation to a Different Location

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

n/a Points
2017-06-08 7:38 pm

My configs are ok. I'm also able to connect using mysqli_connect.I got this message when accessing /wp-admin:

We were able to connect to the database server (which means your username and password is okay) but not able to select the database.

  • Are you sure it exists?
  • Does the user have permission to use the database?
2,858 Points
2017-06-09 10:53 am
Luis, I would recommend that you make sure that your database user has been <a href="">given proper privileges to your database</a>.
n/a Points
2015-05-03 2:17 am

I was able to find the database name, database user,and password in the wp-config.php file. Now I need to make sure these match the information in Cpanel.

However, I don't know where I need to go to do that. When I check the wp-config.php file, aren't I already in Cpanel? I'm not sure what I'm supposed to compare them to.


I clicked on the MySQL databases icon in Cpanel, but there are three databases listed there and three users. I don't now what these three databases are for or who the users are supposed to be. The credentials from the wp-config.php file match one of them, but I don't know if the password does. I'm not sure how to check if the password is accurate. (Essenntially, I don't understand anything I'm looking at on that page...)

Sorry for the noobie question, but I don't know what I'm doing in Cpanel. I just work through the WordPress dashboard. Unfortunately, I keep encountering technical problems (the mot recent being a Error Establishing a Database Connection).

43,761 Points
2015-05-03 8:22 am
Hey Doug,

While you may be technically in cPanel when you are in the File Manager looking at the wp_config file, you will want to compare that info to that in the Database list, located in the Databases category (also in the cPanel).

The databases in the list should have one or more users listed for each of them (typically one). These are the users allowed to access that database. If the wp_config file lists a database and user combination you see in the databases list then that is a good sign. The only thing you cannot test by eyeballing is the password as it is not visible on the page.

If you scroll down to the users list you should see a link next to each user for 'change password'. You can 'change' the password for the proper user to the one listed in the wp_config file. This would ensure the password is the same that WordPress is expecting.

Kindest Regards,
Scott M
n/a Points
2015-01-04 10:41 am

I'm sufering from "Error establishing a database connection". I tried all possible ways and check all things. I can't get rid of this. Please help me.

43,761 Points
2015-01-05 1:06 pm
Hello Sheila,

If you have tried all of the suggestions above, then you would need someone to look at your specific account. If you are one of our customers, you can contact Live Support so they can take a look for you.

Kindest Regards,
Scott M
n/a Points
2014-08-06 2:28 pm
Nice effort and very helpful.thanks for this kind work.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

7 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!