При миграции
# mysql_config_editor set --login-path=root -hlocalhost -uroot -p
# mysql --login-path=root -Ni mysql -e "SELECT User,Host FROM user \ WHERE User!='root' ;" | awk '{print "SHOW GRANTS FOR `"$1"`@`"$2"`\;"}' \ | xargs -I {} mysql --login-path=root -Ni mysql -e "{}" | awk '{print $0";"}'