Return to "Miscellaneous"

Cannot Connect to Database Errors Appear


 
The topic of this article is not supported by our customer support department, however for your convenience we are providing this material to assist you in troubleshooting potential issues related to this topic.

If your site shows “cannot connect to database” error messages, most likely your database server has stopped running, or your database connection information inside of your site programming (such as PHP scripts) is incorrect.

It is important that you check the database connection information inside of your script; most scripts will require the following information:

  • Server name/server hostname: localhost
  • Database username: (your VDS username)
  • Database password: (the password you selected when you installed MySQL)
  • Database name: (the name of the database you have created for the script to use)

If you have all of the correct database connection information, try restarting the VDS; this will stop and restart the database server. The most common cause of the MySQL database server stopping is improper handling of connections to the database by PHP scripts; be sure that your PHP scripts are closing every MySQL connection that they open, or you run the risk of having a number of ‘stuck’ connections that eventually causes MySQL to stop.

Feel free to contact OpenSourceHost’s Customer Support or the developer of your scripts for more assistance preparing your database-driven site for production use.


 

Related Articles: