Have had to reboot server twice in two days

  • Posted December 25, 2013

Hi, I set up a WordPress blog on Digital Ocean and I’ve had to reboot the server twice in two days. After setting up the blog, and posting one story successfully, I returned to admire my beautiful work two hours later only to see the message (Error Establishing Database Connection). I then rebooted the server and got it working again, posted another heartbreaking story successfully, and, after waiting a period of time, I returned to admire my first two stories only to see Error Establishing Database Connection again, which I was able to fix by rebooting the server.

I used the tutorial on your website to setup wordpress with Apache and Mysql.

Is this expected behavior? Is there anything I could do to prevent this from happening?


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

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.

Check out <a href=“”>10 Million hits a day with WordPress using a $15 server</a> (but notice that the author of that blog post now uses a $10/mo. DigitalOcean VPS).

Thanks, the solution provided by Kamal helped! Will also look at nginx. Thanks Pablo

Most people would not tolerate buying a Porsche that needed to be restarted every 2 hours (moving from shared hosting to a VPS is like upgrading from a Chevy Cavalier to a Porsche). Unless you know more about WordPress and web servers than the inventors of WordPress, why not mimic what they do? Check out: <br> <br>1.) <a href=“”>How To Migrate a WordPress Installation from Apache to Nginx on an Ubuntu VPS</a>; <br> <br>2.) <a href=“”>How To Configure Single and Multiple WordPress Site Settings with Nginx</a>; <br> <br>3.) <a href=“”>How To Install Wordpress, Nginx, PHP, and Varnish on Ubuntu 12.04</a>.

I don’t recommend adding a cronjob to restart your server every two hours. In fact, you should <strong>never</strong> need to do that. <br> <br>Your droplet is most likely running out of memory, try adding swap: <br><ul><li>Ubuntu: <a href=“”></a></li><li>Centos: <a href=“”></a></li></ul>

If you are using CentOS then <br> <br>/var/log/httpd/*.log for Apache <br>/var/log/mysqld.log for mysql

What folder are the apache and mysql logs in? I"m just a hobbyist developer trying to learn about servers etc. I can’t hire someone

That is not Windows to restart it every time you get in trouble. It’s a server, so read mysql/apache logs and fix the issue or hire someone to do it for you.

Thanks, can you post a gist explaining how to do the cron job every two hours?

<b>“Error Establishing Database Connection”</b> <br> <br>That’s a very common problem w/Apache + MySQL residing on the same server. That’s why (the inventors of WordPress) dumped Apache – in favor of Nginx – years ago (not to mention that every premium/dedicated WordPress-hosting company also uses Nginx instead of Apache).

Maybe you have to optimize your web server / sql stuff? I’m doing fine and I’m using WP as well. <br>If I was you I will just set up cron to restart AMP every 2 hours etc.