Monthly Archives: September 2011

To retrieve all users of mysql and respective privileges

mysql -B -N $@ -e “SELECT DISTINCT CONCAT( ‘SHOW GRANTS FOR ”’, user, ”’@”’, host, ”’;’ ) AS query FROM mysql.user WHERE user NOT IN (‘root’,’phpmyadmin’,’debian-sys-maint’)”  | \ mysql $@ | \ sed ‘s/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}’

Posted in Uncategorized | Leave a comment