Got some trouble with a VPS where MySQL dies on me from time to time. As a temporarily fix I've installed Monit to make sure that the process is restarted when it dies. I checked the site today and it was down due to Database error, so MySQL had died on me again. I checked Monit it it said "Execution failed".
My configuration looks like this
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if failed host 127.0.0.1 port 3306 type tcp then restart
if 5 restarts within 5 cycles then timeout
if 5 restarts within 5 cycles then alert
I'm running Ubuntu 12.04.3 LTS