Question
Bash Script To Restart mysql Ubuntu 14.04
Hello,
I need a Bash Script To Restart mysql, can someone help please ?
Thank you very much!
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.
×
Hey - I had this issue, but I only wanted to restart mysql if it had stopped.
To simply restart MySQL you can add the following to the root CRONTAB:
This restarts every minute:
If you want to check if MySQL is running first, and start it if it isn’t, then you could add this to the crontab:
PS add this if you want to stop it emailing you the results of every time cron runs the script: