0

I'm writing a monitoring script to restart mysql server if it is down in Linux( Centos+Cpanel).

Will running the command: "mysqladmin status" be sufficient to be sure that it is fully functional?

1 Answer 1

2

Yes. According to the manpage that command will "Check whether the server is available. The return status from mysqladmin is 0 if the server is running, 1 if it is not. This is 0 even in case of an error such as Access denied, because this means that the server is running but refused the connection, which is different from the server not running."

Of-course, if you have a table of specific interest there is nothing to stop you from writing a more specific query and parsing it.

3
  • will netstat -l| grep mysql be better way?
    – AgA
    Feb 21, 2014 at 6:11
  • Probably not. While in theory that will work, all it shows is that MySQL is listening on a socket. Its not as comprehensive a check. Also, if you do go that route, try netstat -ln so it does not try DNS lookups and slow stuff down.
    – davidgo
    Feb 21, 2014 at 6:14
  • Mybe I can use combination of both.
    – AgA
    Feb 21, 2014 at 6:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .