Knowledgebase
HOW TO: fix the “Error Establishing a Database Connection” in WordPress
Posted by Sugen S. on 06 September 2018 01:26 PM

As a dynamic content management system, WordPress relies on a MySQL database that stores your content, website settings and more. If WordPress is unable to communicate with its database, you’ll see an error message stating: Error establishing a database connection.

If your WordPress website was previously working normally, clearly something has changed to break the link between WordPress and the database. Possible causes could be:

  • The database server is down.
  • A change has been made to the database credentials (hostname, username or password) in your wp-config.php file.

If this is the first time you’ve tried to use WordPress, the most likely cause is that your database credentials are incorrect or have changed. Use the following steps to troubleshoot the issue.

Check your WordPress configuration

When installing WordPress, you will have been asked to input a database hostnamedatabase namedatabase username and password. These credentials are stored in your wp-config.php file. A great first step for troubleshooting database connection errors is to check that the database credentials in your wp-config.php file are correct.

You can use an FTP client to access the file on your hosting, or alternatively, use cPanel File Manager.

- Log in to your cPanel.

- Now select File Manager.

- Navigate to your WordPress folder and look for your wp-config.php file. Right click on the file and select Edit.

You’ll see your database credentials listed under MySQL settings. Check that the database hostnamedatabase namedatabase usernameand password are correct. You can find your database credentials at My cPanel > MySQL Databases.

 

Make any necessary changes in your wp-config.php file and then click Save Changes to proceed. Try to access WordPress once again to see if your issue remains.

(0 vote(s))
Helpful
Not helpful

Comments (0)
Copyright © 1998 - 2018 Shinjiru International Inc. All Rights Reserved.