BuycPanel Blog

BuycPanel Blog

Latest news and updates

How to Restore Database Grants in cPanel

Posted by Allura on 12 07 2018.

A Brief Overview

Whenever a database user loses his access to the databases, you can restore the user’s grant to the database with restore grants utility.

Steps to use the restore grants utility to restore the user’s database access

Use either of the commands from the following:-

  • usr/local/cpanel/bin/restoregrants –cpuser=$cpuser –db={mysql, pg} –dbuser=$dbuser
  • /usr/local/cpanel/bin/restoregrants –cpuser=$cpuser –db={mysql, pg}  –all

The following table provides for the variables in the aforesaid example:-

Variable Description
$cpuser The cPanel username that has lost access to databases.
{mysql, pg} The type of database: mysql for MySQL® or pg for PostgreSQL®.
$dbuser The database user whose privileges you that wish to restore.If you use the –all flag, the script will restore grants for all of the database users that the cPanel account owns.


What is the Procedure to update the cPanel user’s password to restore database access

In certain situations, the restore grants script may fail to restore database access.  cPanel users can change their account passwords in cPanel’s  Password & Security interface (cPanel >> Home >> Preferences >> Password & Security).

  • WHM users can reset the password (WHM >> Home >> Account Information >> List Accounts).

Can the root user access a cPanel account without the help of WHM?

WHM >> Home >> Server Configuration >> Tweak Settings. This setting grants the root user access to a cPanel account by default.

What should the user do when our cPanel interface does not display?

The user should contact web hosting provider so that they can determine the cause of the issue or escalate the issue to us.

How can a password be changed in cPanel?

cPanel >> Home >> Preferences >> Password & Security)

Reset of Password

WHM >> Home>> Server Configuration >> Tweak Settings

How to Restore and Access the database

cPanel >> Home >> Preferences >> Password & Security

How can an Error Page be customized?

cPanel >> Home >> Advanced >> Error Pages

Steps followed by a Website Builder in cPanel interface

cPanel >> Home >> Domains >> Site Publisher

Management of Multiple Accounts by cPanel

cPanel >> Home >> Domains >> Addon Domains

Add the domains outside of your public_html directory in order to keep track of them easily.


This Article clearly describes the process by which database Grants in cPanel can be restored with restore grants utility. Whenever a  database user fails to have access to his database essentially requires to restore it.