Cannot connect to database
This is one of the most common error messages to be displayed on any website. The error occurs whenever a server is unable to establish connection with a database. There are many reasons attributed to this, the most common of them being that your login credentials might be erroneous or changed, the database server may be unresponsive or it might have been corrupted, or the server itself might have some problems.
In such cases, there is a list of things that you can do to ensure that your site is up and running again-
- Check for the MySQL host name. It should be local host unless your host provider has changed it.
- The database credentials like username and password should be correct.
- Check for how you have specified your MySQL database username, and ensure that you have suffixed the username with the corresponding database name.
- Also check whether MySQL is running on the default TCP port.
Note: Before making any database changes, it is vital that you have a sufficient backup of all the information lest any mishap should occur and you lose all the data.