SHOW GRANTS for all users on MySQL
October 18th, 2006 by admin
Although there isn’t yet a command (that I am aware of) to show all user GRANTS in MySQL, you can write a quick bash script to do the job if you have shell access:
#!/bin/bash tmp=/tmp/showgrant$$ mysql --batch --skip-column-names -e "SELECT user, host FROM user" mysql > $tmp cat $tmp | while read user host do echo "# $user @ $host" mysql --batch --skip-column-names -e"SHOW GRANTS FOR '$user'@'$host'" done rm $tmp
Posted in Uncategorized