VPS - Ubuntu 12.4 - Mysql service stop automatically every 2days

Posted December 30, 2013 9k views
I am using VPS . with Ubuntu 12.4 (nginx server +mysql) .Am install LEMP with the digitalocean article for installation.. and it works fine.. and then after two days, i get an problem with my site .. (ERROR CONNECTING DATABASE) i have to manually start the mysql service ..(service mysql start) .. So what the problem is ? and how to keep the mysql service live all the time ?

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
2 answers
Your droplet is running out of memory, try adding swap:
by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
MySQL can eat up a lot of resources if having to make a lot of calls to the database. To optimize your site and, as a result, get rid of that error, follow the steps outlined in the following guides:

1.) How To Add Swap on Ubuntu 12.04;

2.) How To Install and Use Memcache on Ubuntu 12.04 (see Kamal's comment of Jun. 30, 2013 for instructions on configuring memcache for use with Nginx);

If you're using WordPress, you'll also be interested in:
3.) How To Install Wordpress, Nginx, PHP, and Varnish on Ubuntu 12.04.
by Etel Sverdlov
Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the server itself if there is a need for an active process. This tutorial covers installing wordpress on a LEMP stack (with nginx instead of apache), and then installing varnish.