Auto Restart Mysql / MariaDB Using Monit In Ubuntu With EasyEngine

Install Monit

$ sudo apt-get install monit

Configure Monit to Monitor MySQL / MariaDB

$ sudo nano /etc/monit/conf.d/mysql
check process mysql with pidfile /run/mysqld/
    start program = "/usr/sbin/service mysql start" with timeout 60 seconds
    stop program  = "/usr/sbin/service mysql stop"
    if failed unixsocket /var/run/mysqld/mysqld.sock then restart
$ sudo service monit reload

Enable Monit service at boot time

$ sudo systemctl enable monit


Leave a Comment

Your email address will not be published. Required fields are marked *