Knowledge Base

< All Topics

How to Repair WordPress Error Establishing A Database Connection?

The following are some steps you can take to resolve the “Error Establishing a Database Connection” error message in WordPress:

Check PHP version: The error is mostly caused by PHP version which is not supported by scripts

1. Log in to your cPanel account and go to Manage MultiPHP Manager

2. Select  the website and

3. Try to downgrade or upgrade the PHP version.

4. Check your database login information: The error is most likely caused by incorrect database login credentials.

5. To check your database login credentials, open your wp-config.php file and look for the following lines:

define('DB_NAME', 'database_name');
define('DB_USER', 'database_user');
define('DB_PASSWORD', 'database_password');
define('DB_HOST', 'database_host');
Make sure that the values for DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST are correct.
The "Error Establishing a Database Connection" error can occur due to a corrupt plugin. To test this, turn off all of your plugins and notice whether or not the error disappears. If the error disappears, you can then individually reactivate each plugin to identify the one plugin that is causing the problem.
Scroll to Top