Thứ Sáu, 10 tháng 6, 2016

How to auto start MySQL if that stop for any reason?

Digital Ocean has a tutorial about it, which also includes an example on how to keep MySQL running. The short synopsis is:
  1. Install monit
    sudo apt-get install monit
    
  2. Edit the configuration file:
    sudo nano /etc/monit/monitrc
    
    and include the following in it:
    check process mysqld with pidfile /var/run/mysqld/mysqld.pid
        start program = "/etc/init.d/mysql start"
        stop program = "/etc/init.d/mysql stop"
    
  3. Reload the new configuration:
    monit reload
    
I strongly suggest you look at the MySQL error log to understand why it is stopping (it should not do this in normal operation). It would be a good idea to also run mysqlrepair to check the status of all tables as you might have some serious DB corruption.

Không có nhận xét nào:

Đăng nhận xét