Check and Restart MySQL with a Cron
If you have a MySQL powered website it is critical that the MySQL Server is running. This little diddy will check to see that the MySQL Server is running and restart it if it's not.You will need to add an entry to your crontab that runs on a interval you are comfortable with. This example runs every minute although you can set it to run as often as you like. The command is very low on system resources so one minute is a good place to start.
0-59/1 * * * * ps -ef | grep mysqld | grep -v grep >> /dev/null || /etc/init.d/mysql start
Note: This should all be on one line in your crontab
Just insert this in your crontab on the server that is running the MySQL server (it's a good idea to put it in the crontab for root or a superuser) and the server will do the rest.