Some time due to high load MySQL server gets killed by OS. So we need to make sure that whenever it gets killed restart the mysql server and send an email notification along with status of mysql server. This is simple and yet effective script.
Please see the monitor_mysql.bash script (download link at the end of script)
Customizing the script. Open the script in text editor such as vi, you can customize following 5 directives (read as variable):
Change this if your mysql admin user is not root.
Setup password, this the ONLY one you need to setup.
Setup hostname if it is not localhost
4) MSTART=”/etc/init.d/mysql start”
This is default on Debain Linux, you need to setup this according to your UNIX/Linux/BSD OS.
Set Email ID to send notification.
Once all done save the file and install script as cron job. For example run this script every minute
* * * * * /path/to/monitor_mysql.bash