Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Jul 2009
    Posts
    5

    Default Remote database creation

    Hi all,

    I've looked through the API docs but couldn't seem to find what I'm looking for. I'm looking for a way to remotely create/delete/edit databases and database users using only the user's cPanel login username and password.

    I've seen a reference to "adduserdb", but didn't see it in the API docs. Here is a sample of what I saw:

    Code:
    user=$cpanel_username&xmlin=".urlencode("<cpanelaction><module>Mysql</module><func>adduserdb</func><apiversion>1</apiversion><args>".$cpanel_username."_$mysql_database</args><args>".$cpanel_username."_$mysql_username</args><args>ALL</args></cpanelaction>
    It would be fantastic if someone could point me in the right direction.

    Thanks a lot!

    Cagy

  2. #2
    Member
    Join Date
    Jul 2009
    Posts
    5

    Default

    Alternatively, and perhaps a better solution, is it possible to create databases etc... from the command line if you ssh into the user's account?

  3. #3
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    There is a way to do this via CLI, using one of cPanel's cPwrap scripts, this is subject to change at any time:

    Code:
    /usr/local/cpanel/bin/mysqlwrap ADDDB foobar
    Now, as for xml-api, this is undocumented and an API1 call:

    Code:
    <cpanelaction>
      <apiversion>1</apiversion>
      <module>Mysql</module>
      <func>adddb</func>
      <args>foobar</args>
    </cpanelaction>
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  4. #4
    Member
    Join Date
    Jul 2009
    Posts
    5

    Default

    Great, thanks for the info. Where can I find the documentation for mysqlwrap and any other CLI utilities?

  5. #5
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Unfortunately at this time I am not aware of any such documentation, although you can strace it out of cpsrvd if you are familiar with process tracing.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  6. #6

Similar Threads & Tags
Similar threads

  1. not able to connect remote MySQL : Remote Database Access Hosts
    By crazyaboutlinux in forum Database Discussions
    Replies: 4
    Last Post: 10-05-2011, 03:55 PM
  2. Replies: 10
    Last Post: 01-23-2011, 08:58 AM
  3. MySQL Database Creation
    By thearchitect in forum cPanel Developers
    Replies: 3
    Last Post: 10-17-2009, 01:31 AM
  4. MySQL Database Creation
    By thearchitect in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 10-17-2009, 01:31 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube