If you use MySQL but don’t use Percona Toolkit you’re really missing a trick. It contains a whole host of useful tools including pt-show-grants which I use to migrate users between servers easily.

pt-show-grants --host mysqlservername --user username --password secret | mysql -h localhost -u username -p

If you want to filter out any specific users, or databases, that’s easy enough with grep;

pt-show-grants --host mysqlservername --user username --password secret | grep -v exclude_database_name | mysql -h localhost -u username -p