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.

Automate creating MySQL database and users for cPanel account

Discussion in 'Database Discussions' started by BraenDead, Feb 23, 2011.

  1. BraenDead

    BraenDead Member

    Joined:
    Dec 8, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Is there a way to automate creating databases and users in MySQL for a particular cPanel account? I can create the database and user in MySQL automatically, but then they do not show up in the list of databases for the user in cPanel. I beleive it has to do with updating the files in /var/cpanel/databases, although there may be other things that need to be set as well. Anyways, if there are any scripts or API's to handle this, that would help tremendously.

    Thanks,

    Bob
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Bob,

    You can always try running /usr/local/cpanel/bin/dbmaptool to setup the mapping for the database to have it properly added to /var/cpanel/databases area, although I do suggest using the APIs instead if possible. You can get the options for /usr/local/cpanel/bin/dbmaptool by running the command without any parameters:

    The API for MySQL is at the following location:

    ApiMysql < ApiDocs/Api1 < TWiki

    There are additional discussions on using the APIs for database mapping at these locations:

    http://forums.cpanel.net/f42/case-4...ing-created-user-created-database-182011.html
    More Details About DB Mapping - cPanel Integration
     
  3. BraenDead

    BraenDead Member

    Joined:
    Dec 8, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I tried using the API and was able to access other tools, but the Mysql::adddb api does not seem to work for me. Anyways - I created a post in the developer forum for this. Thanks for the info.

    Bob
     

Share This Page