Thu, 12 Apr 2012 03:42:57 +0200
mysql, perl

mysql

Show Grants:

mysql --skip-column-names -e "select distinct concat('show grants for''',user,'''@''',host,''';') as query from mysql.user" | \
mysql --skip-column-names | \
perl -ne 'next if m/(?:replica|root)/; s/$/;/; print; END {print "flush privileges;\n" }'

or use maatkit

Show Users:

select user,host from mysql.user;