Created
April 10, 2014 13:47
-
-
Save wagnerpinheiro/10384078 to your computer and use it in GitHub Desktop.
backup mysql users
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 -BNe "select concat('\'',user,'\'@\'',host,'\'') from mysql.user where user != 'root'" | \ | |
while read uh; do mysql -BNe "show grants for $uh" | sed 's/$/;/; s/\\\\/\\/g'; done > grants.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment