Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to monitor the number of MySQL databases with Nagios. I've installed the official Nagios plugins.

I'm using 'check_mysql_query':

./check_nrpe -H -c check_mysql_query

Nagios agent:

command[check_mysql_query]=/usr/lib64/nagios/plugins/check_mysql_query -d mysql -q "select count(*) from information_schema.SCHEMATA where schema_name not in ('mysql','information_schema');" -w 100 -c 150

I had to add client credentials to 'my.cnf' file.


  1. Is there any better/secure solution for this?

  2. What's the minimum MySQL required privileges to run this command:

select count(*) from information_schema.SCHEMATA where schema_name not in ('mysql','information_schema');

share|improve this question
Depending on the version and configuration you're running you may also want to exclude performance_schema from the count. – John Gardeniers Jul 7 '12 at 0:50
up vote 1 down vote accepted
  1. You could remove the where clause and subtract 2 to count(*): COUNT(*)-2.
  2. You need SELECT privileges to do a SELECT.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.