Error establishing a database connection

“Error establishing a database connection” is one of the common errors in WordPress. The causes for this problem could be either your MySQL server is temporarily down or your configuration in config file might be incorrect.


If your MySQL server is down, there is nothing much you can do other than reporting to your host provider to keep it live always. Before you do so, you can check if your configurations are correct. Open wp-config.php and check the database connection properties which will be as follows:

define (‘DB_NAME’, ‘Your-Correct-Database-Name’);
  define (‘DB_USER’,’Your-Correct-Username-for-Database’);
  define (‘DB_PASSWORD’,’your-correct-password-here’);
  define (‘DB_HOST’,’correct-host-name’);