Network - Server

Auto-restart mysql when it dies

 

This is not a clean solution, it would obviously be better to avoid the problem in the first place. Anyway, I am not sure how CentOS manages services but I think it uses service. If so, you can check if the mysql service is running with

/sbin/service mysql status 

This command will exit successfully if mysql is running and return a non 0 exit status if i is not. You can therefore start the service if it is not running with this command:

/sbin/service mysql status || service mysql start 

You can add this line to /etc/crontab to launch thes command every minute:

* * * * * /sbin/service mysql status || service mysql start

0 Bình luận

Trở về
  • Setup window xp từ usb!
  • Setup window xp từ usb!

    Tôi xin chia sẻ với các bạn cách sử dụng USB để làm bộ cài đặt windows xp, giống như một đĩa...

  • Mysql command
  • Mysql command

     # [mysql dir]/bin/mysql -h hostname -u root -p Create a database on the sql server. mysql> create database [databasename]; List...