Run the following command to dump the privilege table into a MySQL syntax that can be easily imported:
/scripts/grabmysqlprivs > privileges.sql
*If you only need a certain user’s privileges, simply use grep command.
/scripts/grabmysqlprivs | grep $user > privileges.sql
On the server you need to restore to, simply import then SQL file:
mysql < /root/privileges.sql
This should be sufficient, however, if you see that the database users are not populated in cPanel, you can try remapping them: