Hi, Here are the steps I have done to add some databases from the another server: Step 1. Imported the databases via SQL using phpMyAdmin Step 2. Created a database user from cPanel Step 3. Run the following command from SSH /usr/local/cpanel/bin/dbmaptool ACCOUNT_USER --type mysql --dbs MY_DATABASE --dbusers DB_USER But I there are two problems with this approach: 1. After running dbmaptool from "step 3." above, was able to let cPanel display the databases. But it did not assign the DB_USER to the database. Database connection will only work if I run the GRANT ALL PRIVILEGES command from MySQL client to this user, but still does not display the user assigned to the database in cPanel. Is something missing here? 2. All imported databases are displaying database size as 0, although there are tables and data in it. This doesn't happen when a database is created from cPanel itself. I have already tried running /scripts/update_db_cache but without luck. Although there aren't any problems if everything was done within cPanel, I would like to run the commands from SSH, so it can be automated without needing any manual intervention. Thank you.
Steps 1 & 2 are backward, IMO. You should have the DB and user for it created before you import data into it.
No, it's not backward, it's the exact step I need to process to achieve my goal. Let's say I have around 100 databases to important, then I need to create the database and user manually from cPanel which will probably take awful lot of time, instead I need the automated solution to be run from linux command line, accessing the cPanel API. Because I can create the commands within an text editor, just replace the database names for the command which will only take like 5 minutes, instead of hours. Hope that make sense. I need to do this frequently to move databases from one place to another for my customers, thank you.
I've had this same issue. i have a script i'm using and i create the database/user and am able to map it with the cpanel dbmap tool command and the db and user shows up in cpanel mysql area. But then I run the ssh for granting all privileged and they don't show up in cpanel mysql area as granted (side by side) I still have to manually grant all privileged. Anyway, let me know if you figured this out or not.