The rebuild_dbmap Script

Valid for versions 82 through the latest version

Version:

82

Last modified: December 7, 2022


Overview

If the database map is corrupt for a cPanel user, you can use the /usr/local/cpanel/scripts/rebuild_dbmap script to rebuild that user’s database map.

Important:
  • Only the root user can run this script.
  • The system treats each option individually. If you pass an invalid value with an option, the script will fail.

Run the script

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

/usr/local/cpanel/scripts/rebuild_dbmap dbuser

Options

Use the following options with this script:

Option Description Example
dbuser Required
The cPanel user for whom to rebuild map information.
example
--noop Display the results of a test run of the script, but do not perform any changes. --noop
--help Display the script’s help documentation. --help

Examples

The following example displays the results for the example user but does not perform any changes:

/usr/local/cpanel/scripts/rebuild_dbmap example --noop

If the script succeeds, the output will resemble the following example:

1
2
3
4
Operating in no-op mode; no changes will be made to your system.

Reading access rights for the cPanel user "example" from live data:
 MariaDB/MySQL ... PostgreSQL ... Done.

The following example generates and installs the database map data for the example user:

/usr/local/cpanel/scripts/rebuild_dbmap example

If the script succeeds, the output will resemble the following example:

1
2
3
4
5
6
7
Reading access rights for the cPanel user "example" from live data:
 MariaDB/MySQL ... PostgreSQL ... Done.
Old DB map file backed up at:
    /var/cpanel/databases/example_backup_2015-07-14_17:17:49_31314.json
Old DB map file removed.
Saving: MariaDB/MySQL ... PostgreSQL ... Done!
Rebuild complete.

Files

This script writes to database map files in the /var/cpanel/databases/ directory. In the example given above, the script rebuilds the /var/cpanel/databases/example.json file, which will resemble the following example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
---
MYSQL:
  example_database:
    - example_test
  example_test:
    - example_test
  example_test123xxxxxxxxxxxxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmx: []

  example_test2:
    - example_test4
  example_wp: []

PGSQL:
  example_test: []

Additional Documentation