WordPress Tutorial: Fixing "Error Establishing a Database Connection"
Are you using WordPress and got an error on your site saying "Error establishing a database connection"? This occurs when your WordPress site is experiencing issues connecting to your database. This may be caused by one of the following reasons:
This error must be fixed right away as it prevents your website from loading, thereby affecting website traffic, sales, etc.

Incorrect Database Credentials
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.
WordPress Hosting Package
If you have WordPress hosting from us, then you can follow the instructions below to find your database credentials in your Account Manager.
- Log in to your Account Manager via https://www.networksolutions.com/my-account/login.
- On the left side of the page, click WordPress.

- If you have multiple WordPress packages, select the package you want to access, then click Manage.
- On the right side of your WordPress Control Panel, under the Configurations section, click Database Manager.

- Take note of the Database Name, Hostname, and Username listed in the MySQL Database table.

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.
- Log in to your Account Manager via https://www.networksolutions.com/my-account/login.
- On the left side of the page, click Hosting.

- If you have multiple hosting packages, select the package where you installed your WordPress, then click Manage.
- Navigate to the Configurations section, then click Database Manager.

- Take note of the Database Name, Server Name, and Username listed in the MySQL Database table.

To find your database credentials via FTP, you need to:
- Connect via FTP and browse the WordPress site's root folder.
- Locate the wp-config.php file.

- Find the database name, database host, username, and password.

- Cross-reference the database information in the Account Manager with the information in the wp-config.php file.
Due to incorrect database credentials, your website fails to communicate with the database. You need to change the database connection string to resolve the issue and ensure data retrieval. Follow the steps below to fix the said error.
- Download the wp-config.php file using FTP.
- Fix the incorrect information.
Note: You can use a program such as Notepad to edit the file.
- Re-upload and overwrite the file with the corrected information.
- Check your website to see if the error has been fixed.
Corrupted Database
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. Please check WordPress Tutorial: How to Back Up and Restore a WordPress Website for steps on how to restore a backup version of your website and database.
Deleted Database
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 Network Solutions by visiting our storefront or finding additional troubleshooting tips here.