lately I have been loading my website, and almost every time I do (once or twice a day) the message: "Error establishing a database connection". I have resolved it temporarily by stopping and starting mysql using 'service mysql stop' then 'service mysql start'.

My website works after I send these commands over ssh.

However this is recurring, every time I load my website, say the next day, I get the same error.

My server is running Ubuntu 14.04 (DigitalOcean) and has mysql, phpmyadmin and wordpress installed.

Can anyone give my some advice on how to resolve this?

1 Answer 1


Anything in the log file?

less /var/log/messages

less /var/log/syslog

As for me, first time over at Digital Ocean I burned myself not setting up a swapfile and with the 500mb RAM I quickly learned that this was needed. (e.g. services/server crashed) Maybe you have more memory available, still worth checking.

You can check with:

sudo swapon -s

If this is the issue, please see their howto on to do this: How-to-add-swap-on-ubuntu-14-04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .