The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Imported datatabase via phpMyAdmin shows 0 size in cPanel

Discussion in 'Database Discussions' started by santocki, Aug 20, 2011.

  1. santocki

    santocki Registered

    Joined:
    Aug 20, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,474
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Steps 1 & 2 are backward, IMO. You should have the DB and user for it created before you import data into it.
     
  3. santocki

    santocki Registered

    Joined:
    Aug 20, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  4. santocki

    santocki Registered

    Joined:
    Aug 20, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Okay, the 0 size problem seems to be solved, it took some time to get reflected in cPanel.

    Thanks.
     
  5. allwebnow

    allwebnow Well-Known Member

    Joined:
    Jan 8, 2007
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    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.
     

Share This Page