WordPress Error Establishing a Database Connection

WordPress Error Establishing a Database Connection

In a nutshell, you are getting this error because WordPress struggles to establish a database connection. Now the key reason why WordPress is unable to begin a database connection can vary. Maybe your database login credentials are wrong or have been changed. It could be that a database server is unresponsive. Maybe your database has been corrupted. In our experience, majority of the times this error happens because of some type of server error however there may be other factors as well. Lets have a look at how to go about troubleshooting this problem.

The message, "Error establishing a database connection", usually means one of two things:
1. Database server is down (not operating)
2. You have wrong information in your wp-config.php--either the DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, or table_prefix is incorrect.

  1. Check your database login credentials. Make sure that the username, password, and database name you're using are correct. You can find these details in your WordPress wp-config.php file.
  2. Repair your database. If your database is corrupt, you can try repairing it using the phpMyAdmin tool.
  3. Check your database server. If your database server is down or experiencing problems, you'll need to contact your hosting provider.



Be sure the database is name is complete and correct along with the database username and that the username is added to the database with all or proper privileges.

The error Error Establishing a Database Connection can also occur if the MySQL / MariaDB service is not up and running. Be sure the service is up and operational.

This can also occur if there is database corruption. Log into your hosting control panel with us and select MySQL the database and repair options.




  • 174 Users Found This Useful

Was this answer helpful?

Related Articles

WordPress error "This file cannot be imported - It may be caused by file_uploads being disabled in your php ini"

The following error may be received if you attempt to upload a theme or file larger than the...

Quickly Disable All WordPress Plugins via phpMyAdmin

Before beginning, be sure to have a backup of your database. You may backup your database by...

There has been a critical error on this website

There has been a critical error on this website.   The error message "There has been a critical...

WordPress error "The uploaded file could not be moved to"

WordPress Upload Error If you're getting the error message "The uploaded file could not be moved...

Install WordPress

Install WordPress with Ultra Web Hosting in Seconds   With Ultra Web Hosting, you can install...