Question
How do I assign a MySQL database or user to a cPanel account through command line?
Answer
You can use the dbmaptool tool to change or assign the cPanel account that owns a MySQL database or user through the command line.
To run this script on the command line, use the following format:
/usr/local/cpanel/bin/dbmaptool [user] [options]
For example, if you wish to assign the MySQL database cp_database to the account cpuser, you would use the following command.
/usr/local/cpanel/bin/dbmaptool cpuser --type mysql --dbs cp_database
For additional information regarding this tool, see the documentation page:
The dbmaptool Script
For information on how to change or assign MySQL database or user through the WHM interface, see the following documentation pages: