Website database not working

Posted January 14, 2015 1.9k 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.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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.