Knowledgebase

The rebuild_dbmap Script  Print this Article

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.

How to call the rebuild_dbmap script

Run the rebuild_dbmap script with the following flags:

  • --noop — Display the results of a test run of the function, but do not perform any changes.

    ./rebuild_dbmap example --noop
    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.
    
    Without the "--noop" flag, this script would generate and install
    the following database map data:
    
    ---
    MYSQL:
    example_database:
    - example_test
    example_test:
    - example_test
    example_test123xxxxxxxxxxxxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmxmx: []
    
    example_test2:
    - example_test4
    example_wp: []
    
    PGSQL:
    example_test: []
    
  • --help — Return help information.

  • dbuser — The cPanel user for whom to rebuild map information.

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

For example, to rebuild the database map information for the user1 cPanel user, run the following command:

/usr/local/cpanel/scripts/rebuild_dbmap user1

If the script succeeds, you will receive confirmation from the command line that resembles the following example:

./rebuild_dbmap example
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.

Was this answer helpful?

Related Articles

WHM Scripts
Overview: The cPanel & WHM installation process adds important scripts to your server’s...
The dbmaptool Script
Overview: You can use the /usr/local/cpanel/bin/dbmaptool script to grant ownership of databases...
The servers_queue Script
Overview: This script allows you to manage the task queue system. The task queue system allows...
The auto-adjust-mysql-limits Script
Overview: The /usr/local/cpanel/scripts/auto-adjust-mysql-limits script updates MySQL®...
The autossl_check Script
Overview: The /usr/local/cpanel/bin/autossl_check script allows you to manually check the SSL...