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;
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/(?:monit|replica|root|ronie)/; s/$/;/; print; END {print "flush privileges;\n" }'}}
Show Users:
select user,host from mysql.user;