I check mysql server status by ssh to the server.
$ mysql mysql> status
Beside this way, is there any other way that I can use ssh to remote check the status? Since there are many mysql servers, I don't want to ssh to each of them. Thanks.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Try mysqladmin, which can query the database for it's status.
On the localhost, you can store the password in a ~/.my.cnf file (make sure the permissions are strict). Here's an example from the MySQL 5.1 manual:
[client] # The following password will be sent to all standard MySQL clients password="my_password"
Then, you can automatically query the remote MySQL server like this:
mysqladmin --host=db1.example.org --user=admin status Uptime: 884637 Threads: 1 Questions: 5534424 Slow queries: 144 Opens: 4444 Flush tables: 21 Open tables: 166 Queries per second avg: 6.259
You'll want to make sure that the firewall on the remote server allows these connections. You'll also want to check that the MySQL privileges allow this sort of access from a remote host. If you are concerned about packet sniffing on your LAN, then configure MySQL to use SSL.
You can avoid these hassles by running the command through ssh.
ssh db1.example.org "mysqladmin status"
You can combine it into one command:
ssh server 'echo status|mysql'
Beyond that, I would look at tools like puppet if you want further automation.