Knowledgebase

How to fix Error Establishing A Database Connection in WordPress Print

  • 1

n this article we will cover the most common cause of Error Establishing A Database Connection error – misconfiguration of database access details.

Make sure that the following conditions are met:

 

  • Database name matches the existing database name
  • Username of the assigned database user matches the existing database username
  • Password matches the one assigned to the specified database user
  • Specified user has access privileges to the site’s database.

Database name, database username and its password can be found in the wp-config.php file located in the root directory of your WordPress installation. In order to check these details, do the following:


1. Log into your cPanel and navigate to File Manager menu:

pl_file_manager_13.png

2. Move to the root folder for your WordPress installation.

3. Click on the wp-config.php file with the right-mouse button and select Edit or View option:

pl_wp_1.png

4. The file should contain the name, username and password of the database assigned to your WordPress installation:

pl_wp_2.png

Once you have found the database details in the wp-config.php file, the next step is to check if they are correct.

5. Go to MySQL Databases in cPanel:

pl_mysql_1.png

6. Carefully check if there is a database which name fully matches the one specified in wp-config.php file:

pl_wp_3.png

7. Then scroll down and check the database username:

pl_wp_4.png

8. Set the password to the one specified in wp-config file:

pl_wp_5.png
pl_wp_6.png

9. Lastly, it is necessary to make sure that the specified user has access privileges to the database:

pl_wp_7.png

10. Click on the All Privileges checkbox and apply the changes. Once done, you will get the message stating that MySQL User has been successfully added to the Database with all privileges:

pl_wp_8.png  

Once the database, its username and password have been changed to the correct ones, the Error Establishing A Database Connection error on your WordPress site should be fixed.

If you experience the same issue after performing the steps above, feel free to contact our support team to get further assistance with this issue.


Was this answer helpful?

« Back

Copyright © 2026 Hostlika.com. All Rights Reserved.