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.

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:
    38
    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
     
  2. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
  3. anand

    anand Well-Known Member

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

    Thanks
     
  4. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Got it working like the way we wanted. Thanks for help.
     
Loading...

Share This Page