Skip to content

Instantly share code, notes, and snippets.

@shollingsworth
Last active November 18, 2020 01:57
Show Gist options
  • Save shollingsworth/03375408dd30123353cd117a0bdc6222 to your computer and use it in GitHub Desktop.
Save shollingsworth/03375408dd30123353cd117a0bdc6222 to your computer and use it in GitHub Desktop.
mysql show grants for all users dynamic
# show grants for all users one liner
cat <<EOF | mysql | grep SHOW | mysql | sed 's/^Grants/# Grants/'
select distinct concat('SHOW GRANTS FOR ', QUOTE(user), '@', QUOTE(host), ';') as query from mysql.user;
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment