4 Fixes to “Error Establishing establishing a database connection” in WordPress.

When you go to your website, hoping to see your beautiful design, all you get is a blank page and a warning that says “problem establishing a database connection.” When WordPress is unable to connect to the database, this error occurs.

This connection problem might be caused by a number of factors. We’ll look at what causes the issue of establishing database connection messages and how to repair it in this post.

What is a WordPress Database, and how does it work?

A database is a table that keeps information like your articles, pages, widgets, colors, and titles. WordPress can access, arrange, and retrieve this information to present to your visitors.

You’ll notice a notification that reads “error establishing database connection” and a blank screen if the database can’t be accessed. It’s blank because it doesn’t have any data to display.

What Causes the Error Establishing Database Connection Error?

First and foremost, do not be frightened. This is a typical error, and it does not imply that your data has been lost. It can be fixed.

This mistake can be caused by a number of factors. Among the most frequent are:

  • Your WordPress settings include incorrect information.
    • A database that has become corrupt.
  • The database server isn’t working right now.
    • WordPress files that have been corrupted.
  • There is an excessive amount of traffic.

Let’s have a look at how to troubleshoot and resolve the establishing database connection error. There’s no need to complete the remaining stages after you’ve identified the issue.

1. Inspect Your Database Passwords

The error establishing database connection error is most commonly caused by this. Incorrect database credentials don’t change on their own, but this might be the problem if someone has been making modifications to the files, hosting, etc.

WordPress uses the MySQL database management system to store the data. On a server, this database is kept. WordPress need the following information in order to access the database on this server:

  • Database name
  • Username
  • Password
  • Database server

These are the credentials for the database. All this information is kept in the wp-config.php file. WordPress cannot create a connection if any of the information in the file is wrong, and you will receive a connection error.

Check the wp-config File

4 Fixes to "Error Establishing establishing a database connection" in WordPress.

You’ll need access to your server’s files to check your WordPress database credentials. Select File Manager from your host’s cPanel, then the folder for your website.

4 Fixes to "Error Establishing establishing a database connection" in WordPress.

It’s possible that your files will differ from mine. I have one primary site and a slew of test sites behind it. As a result, I have a public_html folder containing the files for my main site, as well as unique folders for each of the other sites on the server. Open the folder that corresponds to the site you wish to examine.

4 Fixes to "Error Establishing establishing a database connection" in WordPress.

Locate the wp-config.php file and right-click to see the settings. Before making any changes, create a backup and then choose Edit.

4 Fixes to "Error Establishing establishing a database connection" in WordPress.

A section titled MySQL settings may be found by scrolling down. Look for the database name, username, database password, and hostname information. The next step is to double-check that the information is correct.

4 Fixes to "Error Establishing establishing a database connection" in WordPress.

Checking Database Credentials

Select MySQL Databases from your host’s cPanel.

4 Fixes to "Error Establishing establishing a database connection" in WordPress.

Next, double-check your current databases to make sure your database name and username are correct.

4 Fixes to "Error Establishing establishing a database connection" in WordPress.

Then scroll down to the current user’s section. You may update the password and see the usernames here.

Make Sure They Match

Make the necessary adjustments to the database name, username, and password, and try refreshing the webpage.

2. Check Your WordPress Dashboard

To access your WordPress dashboard, append /wp-admin to the end of your URL, like seen below:


Continue to the next step if the error “establishing a database connection” appears. If you get a different message, pay attention to what it says. This might be the key to finding a solution.

If you can access the dashboard, disable any plugins, themes, or scripts until the issue resolves.

Also Read these:

3. Repair Your Database

If you try to log in as an administrator to your website, you’ll encounter a warning that states “One or more database tables are inaccessible.” It’s possible that the database may be in need of repairing.”

You may fix the database in this scenario by adding a line of code to your wp config.php file.

‘That’s all, quit editing!’ says the file when you open it. ‘Have fun blogging.’ Add the following code just above this line:

define('WP_ALLOW_REPAIR', true);

Next, navigate to your website’s repair page:


You have two alternatives as a result of this:

  1. Repair Database – WordPress will check for and fix the most frequent issues.
  2. Repair and Optimize Database – WordPress will address the problem and search for ways to enhance performance.

Both can take a long time to finish. This page is open to the public. Remove the code from your config file once you’ve finished the repair.

4. Check if Your Server is Down

We don’t anticipate our servers to go down, but no server can guarantee 100 percent uptime. If you’re on a single server, this is more likely to happen. If you have a cloud-based subscription, your site will simply draw data from another server if one fails.

you’re using shared hosting, significant traffic may cause your server to go down. When this happens, if the server is sluggish enough, your site may display this error.

First, Open SmallSEOTools Check Server Status, After pasting your website address Click on Check Server Status;

You can see your status from here, If it is green that’s mean your server is running fine, If it is red then it means your server is down/


That concludes our discussion of how to troubleshoot and resolve the issue by establishing a database connection notice on your WordPress website. These processes aren’t tough, but they might take some time to figure out.

Use high-quality themes, plugins, and hosting wherever possible. Also, just in case there are no other options, make sure you have a backup. Contact your host for assistance before removing vital files.

Also Read these:

Leave a Comment