Restoring Mysql Database Privileges

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:

/usr/local/cpanel/bin/setupdbmap

Restoring Mysql Database Privileges

Leave a Reply

Your email address will not be published. Required fields are marked *

Fork me on GitHub