In case a user of a database cannot access the databases, you can then restore their access privileges using the restoregrants utility.
You can use one of the following commands to re-establish database for a user access through the restoregrants script:
In the table given below you will find variables that are used by the example above:
|$cpuser||The stands for the username of the cPanel user who cannot gain access to their databases.||username|
|$type||The database category:
● mysql for MySQL
● pg for PostgreSQL®
|$dbuser||This includes the user of your database whose access privileges you want to restore.
● While using the –dbuser flag, $dbuser stands for the database user.
● While using the –all flag, the script re-establishes grants for all of the database users belonging to the cPanel account.
It might not always be possible to restore database access for the user using the restoregrants script. In case the script fails, there are still ways in which the access can be restored. The owner of the account, who may either be a WHM user or a cPanel user, can restore the account password to grant access to the user. The reseller or server administrator can also re-establish grants for the user who wants to access the database.
A cPanel user can use the following steps to re-establish access to database:
The reseller or server administrator can restore grants with the steps mentioned below:
There are workarounds available in case a user is unable to access the files in a database. Follow the steps outlined in this article to restore grants to the user.