Created
December 19, 2011 22:57
-
-
Save noelrocha/1499300 to your computer and use it in GitHub Desktop.
export MYSQL privileges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u [USER] -p[PASSWORD] -B -N $@ -e "SELECT DISTINCT CONCAT( | |
'SHOW GRANTS FOR ''', user, '''@''', host, ''';' | |
) AS query FROM mysql.user" | \ | |
mysql -u [USER] -p[PASSWORD] $@ | \ | |
sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment