如何获取远程机器的MySQL服务状态?

Pic*_*u27 0 mysql linux

我的应用程序服务器和数据库服务器使用单独的 Linux 机器(Cent-OS)。

我需要从我的应用程序服务器机器上显示远程机器 MySQL 状态。

像“service mysql status”的输出

我有远程机器 MySQL 访问权限。是否可以通过运行 shell 命令从我的应用程序服务器获取远程 dB 状态?

Pic*_*u27 6

可以使用以下命令识别远程/客户端 mysql 状态,

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
Run Code Online (Sandbox Code Playgroud)