Monthly Archives: June 2015

Handy One-Liners

Show all MySQL Users’ GRANTS:  Bash |   copy code |?12# oIFS="$IFS"; export IFS=$’\n’; for i in $(mysql –skip-column-names –batch -e "SELECT user,host FROM mysql.user"); do USER=$(echo $i|awk ‘{printf $1}’); HOST=$(echo $i|awk ‘{printf $2}’); mysql –skip-column-names –batch -e "SHOW GRANTS FOR ‘$USER’@’$HOST’"; done; export IFS="$oIFS";3

Posted in Uncategorized | Leave a comment