Picasu27
Picasu27

Reputation: 190

How to get MySQL service status of remote machine?

I am using separate Linux machines(Cent-OS) for my application server and Database server.

I am in-need to show remote-machine MySQL status from my application server machine.

like the output of "service mysql status"

I had remote machine MySQL access. Is it possible to get remote-dB status from my application server by running shell commands?

Upvotes: 1

Views: 4556

Answers (3)

Picasu27
Picasu27

Reputation: 190

Remote/Client mysql status could be identified using following commands,

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


mysqladmin --host=db1.example.org --user=admin ping
mysqld is alive

Upvotes: 9

You could connect (using mysql_real_connect function or mysql command) to the server and issue a SHOW STATUS; and/or SHOW PROCESSLIST; MySQL request.

Upvotes: 2

Nir Alfasi
Nir Alfasi

Reputation: 53535

If you can use SSH to access the machine remotely you can do: ps -ef | grep mysqld to see if mysql is up and running.

Upvotes: 0

Related Questions