Website database not working

January 14, 2015 1.6k views

I have a website hosted on my friend’s account whose url is . I am using wordpress on that website and receiving an error message Error establishing a database connection. Even my friend’s website hosted on the same account with wordpress is getting the same error message. So please help me fix this problem as soon as possible. I am even receiving some dns errors. Please fix these problems. My friend’s website url is . Both my and my friend’s website are hosted on digital ocean only.

1 Answer

Are you seeing anything in the error logs for your webserver? If you’re using Apache on Ubuntu, you can find those logs in /var/log/apache2/error.log

It’s quite likely that the “error establishing a database connection” is due to your MySql database crashing when running out of memory. One way to help protect yourself against this is to enable a SWAP file on the server. Check out this tutorial for more info:

by Justin Ellingwood
Swap space can be used as an "overflow" area for your system when you run out of RAM. The operating system can store data that would normally be kept in RAM on the hard drive in a specially formatted file. In this guide, we'll demonstrate how to create and use one of these files in Ubuntu 14.04.
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!