The dbmaptool Script

Valid for versions 82 through the latest version

Version:

82


Last modified: January 29, 2021

Overview

The /usr/local/cpanel/bin/dbmaptool script grants ownership of databases and database users to a cPanel account.

Note:

This script does not map a virtual user to a database.

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/bin/dbmaptool [user] [options]

Options

Use the following options with this script:

Option Description Example
user Required.
The cPanel username to grant database ownership to.
username
--dbs A comma-separated list of the database names that the account will own. --dbs 'db1, db2'
--dbusers A comma-separated list of the database users that the account will own. --dbusers 'virt1, virt2'
--type The database type:
  • mysql — MySQL® database.
  • pg — PostgreSQL® database.
--type 'mysql'
--help Display the script’s help documentation. --help

Example

To grant ownership of the db1 and db2 MySQL databases and the virt1 and virt2 database users to the username cPanel account, run the following command:

/usr/local/cpanel/bin/dbmaptool username --type 'mysql' --dbs 'db1, db2' --dbusers 'virt1, virt2'

If the script succeeds, it will not return output.

Additional Documentation