When the user of a database loses access to databases, the user’s grants to the database can be restored with the aid of the restoregrants utility.
Restoregrants Script
The
restoregrants script can be used to restore the user’s access to database. For
this purpose it is required to run one of the below-mentioned commands from the
command line.
1st command /usr/local/cpanel/bin/restoregrants --cpuser=$cpuser --db=$type --dbuser=$dbuser
2nd command /usr/local/cpanel/bin/restoregrants --cpuser=$cpuser --db=$type --all
The variables used in
the command, as well as what these represent, are listed below.
$cpuser - It represents
the cPanel username that lost access to its databases.
$type – It represents
the database type. Mysql for MySQL. Pg for PostgreSQL.
$dbuser – It
represents the database user, whose privileges need to be restored. If the dbuser
flag is used, then the database user is represented by $dbuser. If the all flag
is used, then the script acts to restore grants for all the users of the
database that belong to the cPanel account.
Update the Password of the cPanel User
In certain rare
cases, the restoregrants script might fail to restore access to the database. In
such a situation, where the script fails, the cPanel account’s password can be
reset to restore grants by either the cPanel user or the WHM user, who owns the
account.
A cPanel user needs
to follow the below-mentioned steps for restoring grants.
- Navigate to the Password & Security interface of cPanel.
- Select the option, Allow MySQL password change.
- Enter the old password in the text box for Old Password.
- Enter a new password in the text boxes, New Password and New Password (again).
- Click Change your password now.
The server
administrator or a reseller needs to follow the below-mentioned steps for
restoring grants.
- Navigate to the List Accounts interface of WHM.
- Click the + link that is next to the appropriate account.
- Select Sync MySQL password with account password.
- Enter the new password in the text box, Change Password.
- Click Change.
This concludes the
process.
For the uninitiated,
cPanel refers to a control panel that is meant for web hosting. It has been
developed by cPanel LLC. It provides automation tools along with a graphical
interface to a website owner for simplifying the process of hosting a website. In
this context, web hosting is a service provided by various web hosting
companies that exist in different parts of the world. It is meant for rendering
websites accessible over the Internet. In it, web server space is offered along
with the necessary services and technology that are needed to make websites
accessible online. Web hosting is of various types such as shared, reseller,
dedicated, VPS, cloud, WordPress etc. Web hosting companies provide different
plans for each type of hosting service. The most efficient web hosting
companies are sometimes referred to as the, “Best Windows Shared
Hosting Company” or as the, “Best Linux Dedicated
Hosting Company” or as the “Top Cloud Hosting
Company”, depending on the type of web hosting service.
Source:
https://www.htshosting.org/knowledge-base/technology/137/how-to-restore-a-user-s-database-access
No comments:
Post a Comment