MySQL. Перенос/экспорт пользователей и привилегий

pt-show-grants

Установка

apt install percona-toolkit

или

wget percona.com/get/pt-show-grants
chmod +x pt-show-grants

Экспорт

pt-show-grants -uUSER -pPASSWORD > user_grants.sql

Другие варианты

mysql -h {host_name} -u {user_name} -p{password} -Ne "select distinct concat( \"SHOW GRANTS FOR '\",user,\"'@'\",host,\"';\" ) from user;" mysql | mysql -h {host_name} -u {user_name} -p{password} | sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}' > user_grants_2.sql

https://www.percona.com/doc/percona-toolkit/3.0/pt-show-grants.html
https://habrahabr.ru/post/328604/
https://faish.al/2014/03/20/exporting-all-mysql-user-privileges/
https://wisdmlabs.com/blog/migrate-mysql-users-one-server-another/