Last time I had some issues with MySQL server on my VPS. I fixed them but just in case I wrote a small bash script to check the MySQL status, if it’s down to start it.
You have to run this script using a cron job.
Create a scheduled cron job via Webmin-> Scheduled Cron Jobs->Create a new scheduled cron job
systemctl status mysql.service | grep "stopped\|dead"
if [ $? -eq 0 ]; then
systemctl start mysql.service
You shouldn’t be doing this manually, as Webmin / System and Server Status module can do it for you:
I didn’t know that option. Thank you Ilia.
You shouldn’t be doing either of these things!
If any service is dying seemingly randomly, you should find the root cause and fix it.
Edit: This is especially true of a database, which can become corrupt and lose data if it is being improperly shut down for some reason (OOM killer, perhaps?).