I have an existing MySQL instance (test), containing 2 databases and a few users each having different access privileges to each database.
I now need to duplicate one of
In complement of @Sergey-Podushkin 's answer, this shell script code is workin for me:
mysql -u -p -N mysql -e "select concat(\"'\", user, \"'@'\", host, \"'\"), authentication_string from user where not user like 'root'" | while read usr pw ; do mysql -u -p -N -e "SHOW GRANTS FOR $usr" | sed 's/\(\S\)$/\1;/'; done