Reputation: 8880
MySQL provides a neat way to keep tabs on the status of the db server via SHOW STATUS
. The only issue is that the information that is returned is too voluminous. For my needs I only need to get hold of a handful of values - say UPTIME
, THREADS_RUNNING
, THREADS_CREATED
etc. I am unable to figure out the right syntax to use to issue such a query.
'SHOW GLOBAL STATUS LIKE "uptime"'
gives me uptime but I would like to get a few more values in a single query. I'd be most grateful to anyone who might be able to tell me how to do this.
Upvotes: 3
Views: 790
Reputation: 7590
When you need to query system variables, schemas, etc... you should look for it in INFORMATION_SCHEMA. In this case you probably need INFORMATION_SCHEMA.GLOBAL_STATUS
.
Upvotes: 2
Reputation: 32260
All this information is available in the information_schema
database, GLOBAL_STATUS
table.
Your MySQL user needs read
permission tho:
SELECT * FROM information_schema.`GLOBAL_STATUS`
WHERE VARIABLE_NAME IN ('UPTIME', 'THREADS_RUNNING')
Upvotes: 2