What is Error establishing a database connection?

You may encounter a database error when accessing your WordPress website. Here are the common reasons why you are getting the error establishing a database connection message:

  • wrong database password
  • wrong database name
  • wrong database username


How to fix error establishing a database connection?

via cPanel

Step 1. Log in to your cPanel.


Step 2. For cPanel,  click File Manager under Files panel.


Step 3. Locate WordPress directory.

Step 4. Click on wp-config.php.


Step 5. Click on Code Editor.


Step 6. Read the guidelines and click Edit button.


Step 7. In the editor page, locate the database name, username and password.edit-wp-config-php

Check the database credentials and make sure all are correct. Modify all the necessary credentials and update it.

Step 8. Click Save Changes button located at the upper right hand corner of the page.



via FTP

Step 1. Access FTP.

Step 2. Locate WordPress directory.

Step 3. Click on wp-config.php and download.

Step 4. Access the file via editor.

Step 5. Locate the database name, username and password.

// ** MySQL settings – You can get this info from your web host ** //

/** The name of the database for WordPress */

define(‘DB_NAME’, ‘databasename’);

/** MySQL database username */

define(‘DB_USER’, ‘databaseusername);

/** MySQL database password */

define(‘DB_PASSWORD’, ‘databasepassword);

Step 6. Save the wp-config.php file and upload it into your WordPress directory. You may need to overwrite the existing wp-config file.

Do not hesitate to contact our support team if you have further questions.

Error establishing a database connection

(Visited 52 times, 1 visits today)