Sometimes your WordPress website won’t load and gives the following error:
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.
- Are you sure you have the correct username and password?
- Are you sure that you have typed the correct hostname?
- Are you sure that the database server is running?
If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
As suggested in the error, the Error establishing a database connection error occurs because the web server is unable to contact the database server instance. This is generally caused by one of the following:
- There’s a networking, DNS or firewall problem stopping the web server connecting to the database server
- There’s a problem with the database server instance
- The settings are incorrect in the WordPress configuration file (wp-config.php)