_ Detection script mysql survival status

! # bin / bash
#: test the mysql service is alive
# Author: liusingbon
# Host is the IP address of the mysql host you need to be detected, user is mysql account name, passwd is the password; the information required before use according to the practical situation
= 127.0.0.1 Host
User = the root
the passwd = 123456
mysqladmin -H 127.0.0.1 the root -p -u '$ the passwd' of ping &> / dev / null
IF [-eq $ 0?]; the then
   echo "IS MySQL up"
the else
   echo "MySQL IS Down"
fi

Guess you like

Origin www.cnblogs.com/liusingbon/p/11104370.html