What causes the “Error Establishing a Database Connection” Error?

What causes the “Error Establishing a Database Connection” Error?

There are a few possible reasons you may be seeing this error that include

  • Too many Database connections – generally at times of very high traffic
  • Corrupted Database Tables – possibly from an abrupt server shutdown
  • Incorrect credentials in wp-config.php
  • Recently installed plugin

How to troubleshoot “Error Establishing a Database Connection”

Step 1) Disable all plugins

If you are able to get to the WordPress Dashboard, try disabling all plugins.

If you are unable to get to the WordPress Dashboard, you can access your server via FTP or your web host’s file manager and can delete plugins from there.

Step 2) Check the credentials in wp-config.php

Connect to your server via SSH or SFTP and inspect the wp-config.php file, ensuring the correct Database credentials are supplied.

If you are not sure, you can change the MySQL password via your host’s control panel, update your wp-config.php file, and see if the error persits.

Step 3) Repair your MySQL Database

To repair the MySQL Database, log in to your web host’s control panel and open phpMyAdmin.

Choose a database from the left.

phpmyadmin selecting a database

Select the tables individually or all at once with the checkboxes or “Check All” link, and select repair from the drop down menu.

selecting tables and repairing phpmyadmin

If the repair was successful you will see a message similar to the following.

successful database repair

If none of the above approaches have worked you may need to reinstall WordPress, before which, we recommend backing up your content and database.


Leave a Reply

Your email address will not be published. Required fields are marked *

Send this to friend