Page tree
Skip to end of metadata
Go to start of metadata

Overview

You can use the /usr/local/cpanel/bin/dbmaptool script to grant ownership of databases and database users to a cPanel user via the command line.

How to call the dbmaptool script

Run the dbmaptool script with the following flags:

FlagDescriptionExample
--typeThe database type to which you wish to assign owners
  • 'mysql'
  • 'psql'
--dbsThe names of the databases that the cPanel user will own, separated by commas. 'db1', 'db2'
--dbusersThe names of the database users that the cPanel user will own, separated by commas.'virt1', 'virt2'

Important:

The system treats each flag individually. If you pass an invalid value with a flag, the script will fail.

 

For example, if you wish to grant ownership of the db1 MySQL® database with the virt1 database user to the user1 cPanel user, run the following command:

/usr/local/cpanel/bin/dbmaptool user1 --type 'mysql' --dbs 'db1' --dbusers 'virt1'

If the script succeeds, you will not receive confirmation from the command line.

Additional documentation