Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

list of dbs for users

Discussion in 'cPanel Developers' started by anand, Jun 22, 2011.

  1. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Hi,

    I am looking for help on getting list of databases for a setup of cpanel users. Basically we want to create a small internal app, which takes a particular list of users, goes in each account, get a list of their respective databases, and back them up.

    I know we can backup all databases, its much easier, but we to only backup for a set of users, and these users keep on adding more dbs to the server, so the only way it will work flawlessly is via the api.

    Any help would be appreciated.

    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. MattDees

    MattDees Well-Known Member

    Joined:
    Apr 29, 2005
    Messages:
    416
    Likes Received:
    1
    Trophy Points:
    243
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This should be done rather easily via the API2 MysqlFE::listdbs call. To call this you would use a URL like:

    Code:
    /xml-api/cpanel?cpanel_xmlapi_module=MysqlFE&cpanel_xmlapi_func=listdbs&cpanel_xmlapi_user=$username
    . At this point, it should return an XML list of the databases that belong to that user and you can kick off a "dump" process from there.

    There are a few libraries that can assist you with this, please see http://github.com/CpanelInc for a listing of them (perl and PHP)

    Please let me know if you have any more questions/problems that we can assist you with.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Great, let me try it out.

    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Got it working like the way we wanted. Thanks for help.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice