Loading...

Knowledge Base
Save 25% on a custom website!

Fixing "Error Establishing a Database Connection"

Fixing "Error Establishing a Database Connection" can be intimidating. This error suggests that your WordPress site is experiencing difficulties connecting to your database. In this extensive guide, we will provide you with solutions to make sure that your website is always up and running. This may be caused by one of the following reasons: 

  • Incorrect Database Credentials 

  • Corrupted Database 

  • Deleted Database 

This error must be fixed right away as it prevents your website from loading, thereby affecting website traffic, sales, etc.

Error Establishing a Database Connection

This is one of the most common reasons why you have the “Error establishing a database connection” error message on your website. To fix this error, you should check and ensure the accuracy of your database credentials.

You can find your database information in your Account Manager and in the root folder of your WordPress site, accessible via FTP. 

In this section, we will discuss:

How to Find My Database Credentials in My Account Manager

WordPress Hosting Package

If you have WordPress hosting from us, then you can follow the instructions below to locate your database credentials in your Account Manager.

  1. Log in to https://www.web.com/my-account/login.
  2. On the left side of the page, click WordPress.
    WordPress Package
  3. If you have multiple WordPress packages, select the package you want to access, then click Manage.
  4. Under Configurations, click Database Manager.
    Database Manager
  5. Take note of the Database Name, Hostname, and Username listed in the MySQL Database table.
    Database Credentials

 

Hosting Package that Uses WordPress

If you have WordPress installed in your hosting package, then you can follow the instructions below to locate your database credentials in your Account Manager.

  1. Log in to https://www.web.com/my-account/login.
  2. On the left side of the page, click Hosting.
    Hosting Package
  3. If you have multiple hosting packages, select the package where you installed your WordPress, then click Manage.
  4. Navigate to the Configurations section, then click Database Manager.
    DB Manager
  5. Take note of the Database Name, Server Name, and Username listed in the MySQL Database table.
    DB Credentials

 

How to Find My Database Credentials Via FTP

To find your database credentials via FTP, you need to:

  1. Connect via FTP and browse the WordPress site's root folder.
  2. Locate the wp-config.php file.
    wp-config.php file
  3. Find the database name, database host, username, and password.
    Database Information
  4. Cross-reference the database information in the Account Manager with the information in the wp-config.phpfile.
    Note: If the information does not match, the website files cannot connect to the database properly, thus having an “Error establishing a database connection” on your website.

 

How to Fix the Database Connection Error

Due to incorrect database credentials, your website fails to communicate with the database. You need to update the database connection string to resolve the issue and ensure data retrieval. Follow the steps below to fix the database connection error. 

  1. Download the wp-config.php file using FTP.
  2. Fix the incorrect information.
    Note: You can use a program such as Notepad to edit the file.
  3. Re-upload and overwrite the file with the corrected information.
  4. Check your website to see if the error is fixed.

A corrupted database contains data that has been altered to the point that it is no longer usable. This can be caused by faulty WordPress plugins or themes or by a hacking incident. If you have cross-checked that the database credentials in the Account Manager match those in the wp-config.php file,  then a corrupted database may be the cause of the website error. The recommended action is to restore your website using a backup version of the database. Below are the steps for restoring your website files and database.  

Select the option below:

WordPress Hosting Package

If you have WordPress hosting from us, then you can follow the instructions below.

  1. Log in to https://www.web.com/my-account/login.
  2. On the left side of the page, click WordPress.
    WordPress
  3. If you have multiple WordPress packages, select the package you want to fix, then click the Manage button.
  4. On the Security section of the WordPress Control Panel, click Backups.
    WordPress Backups
  5. Select a backup version you want to restore, then click the Restore button.
    Restore Website

 

Hosting Package that Uses WordPress

If you have WordPress installed in your hosting package, then you can follow the instructions below.

  1. Log in to https://www.web.com/my-account/login.
  2. On the left side of the page, select Hosting.
    Hosting
  3. If you have multiple Hosting packages, select the package where your WordPress is installed, then click the Manage button.
  4. In the Hosting Control Panel, navigate to the Configurations section, then click Website Backups.
    Website Backups
  5. Select the daily snapshot you want to restore, then click Restore to Snapshot.
    Restore Site

Your WordPress site will be unable to retrieve data if the database is deleted from your hosting account. If you have accidentally deleted your database, you can contact us to see if we can restore it.   

Review

This is an article about how to fix “Error Establishing a Database Connection” in Wordpress. It covers three possible causes of the error: incorrect database credentials, a corrupted database, and a deleted database. The article also provides instructions on how to fix the error in each scenario. Some important tips to follow are: back up your website before making any changes and verify the information in your Account Manager against the data in the wp-config.php file. 

You can learn more about WordPress hosting with Web.com by visiting our storefront or finding additional troubleshooting tips here

Did you find this article helpful?

 
* Your feedback is too short

Loading...