be careful! Monitor whether MySQL service is normal. Just understand these four methods



Monitor whether the MySQL service is normal. The general idea is: check whether port 3306 is started, PS check whether the mysqld process is started, log in to MySQL from the command line, return the result of the execution statement, detect PHP or JSP programs (developers are required to develop programs), etc;

Method 1: listen to port 3306


Method 2: View mysqld process

Note: if process filtering is used, if the script name contains mysql, the script execution will be flawed. Remember!!! Because the script will also be grep once, resulting in inaccurate results;


The results are as follows:


Method 3: double insurance. The MySQL service is normal only when the process and port are successful


Method 4: use the client to log in to MySQL and execute the command to check the returned results and test whether the service is started. Theoretically, this method is the most reliable.


The results are as follows:

[[email protected] baby]# sh

MySQL is running

The above are four ways for shell script to monitor whether MySQL service is normal. I hope it will be helpful to your study.

Finally, it is recommended to share the high-quality content of C / C + + and algorithms, learning and communication, technical discussion, interview guidance, resume modification There are many source materials and other learning materials, zero basic videos waiting for you!

If you haven’t paid attention, you can long Click to pay attention:


Recommended Today

Use of String

1. Use of String String s1 = “abc”;//How literals are defined String s2 = “abc”; System.out.println(s1==s2)//true, s1, s2 point to the same address   1. String is declared final and cannot be inherited2. The String class implements the Serializable interface: indicating that strings support serialization,Implements the Comparable interface: indicates that String can be compared in […]