If a database user loses access to databases, you can restore the user's grants to the database with the restoregrants utility.
Execute either of the following commands from the command line:
/usr/local/cpanel/bin/restoregrants --cpuser=$cpuser --db={mysql, pg} --dbuser=$dbuser
$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 --dbuser fiag, the $dbuser variable will consist of the database user's name. If you use the --all flag, the script will restore grants for all of the database users that the cPanel account owns.