in Code Snippet

Shell script to restart MySQL automatically when it shuts down.

A dirty hack but essential at times, the MySQL server consumes higher memory if not configured correctly and due to this the MySQL service is terminated by the OS to save itself from crashing under high traffic.

A simple shell script can be used to restart the MySQL service when it is terminated.

Download this script using wget


Make the script executable

sudo chmod +x

Execute this script each minute with a crontab

sudo crontab -e
*/1 * * * * sh /path/to/script/

Write a Comment