Introduction
MySQL and MariaDB do not have a concept of ownership. To restrict cPanel users' database access to the databases their account owns, cPanel has implemented database mapping. Mapping a database ensures it may be managed within the cPanel user's account, including phpMyAdmin.
This article provides the steps to map a database to a cPanel user's account using the dbmaptool
script.
Procedure
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Run the following command.
/usr/local/cpanel/bin/dbmaptool $cpusername --dbs '$dbname' --type '$sqlserver'
Please note that "$cpusername" and "$dbname" must be replaced by the cPanel account username and the name of the database to map to the account, and "$sqlserver" must be replaced withmysql
if the database is a MySQL/MariaDB database orpg
if it is a PostgreSQL database.