Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    2

    Default MySQL Database Creation

    Is there a way to allow a hosting account user to create a MySQL database programmatically with a SQL statement?

    At the moment phpMyAdmin for all the hosting accounts is showing 'No privileges' under Create Database. I assume that this is locked down by WHM.

    Anyone have an idea how to address that issue? We are running our own server, so we can configure anything in WHM the way we want to.

    Thanks,

    JB

  2. #2
    Member
    Join Date
    May 2008
    Posts
    1,203

    Default

    You can assign the privileges to the database from the cPanel. You will have to login to your cPanel account and under MySQL click on your database and assign the privileges.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    2

    Default

    Thanks for your response and yup, that would be the way to change privileges for an already existing database.

    What I am after though is changing privileges for a user account to be able to create databases from within MySQL with a CREATE DATABASE command. That seems to be disabled through WHM. So I am looking for a way to doing that.

    The issue is that I need to create databases dynamically from within my PHP class. The database user I am connecting to the database with doesn't seem to have the privileges to do so.

    Trying to add the database creation privileges to the database user account I can do temporarily, but they seem to get reverted back by some process within cPanel or WHM. So, I am still looking for some setting in WHM that would allow me to pull this of.

    Thanks,

    JB

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by thearchitect View Post
    Thanks for your response and yup, that would be the way to change privileges for an already existing database.

    What I am after though is changing privileges for a user account to be able to create databases from within MySQL with a CREATE DATABASE command. That seems to be disabled through WHM. So I am looking for a way to doing that.

    The issue is that I need to create databases dynamically from within my PHP class. The database user I am connecting to the database with doesn't seem to have the privileges to do so.

    Trying to add the database creation privileges to the database user account I can do temporarily, but they seem to get reverted back by some process within cPanel or WHM. So, I am still looking for some setting in WHM that would allow me to pull this of.

    Thanks,

    JB
    cPanel/WHM does have APIs for creating database users and databases. While this isn't the same as using the CREATE DATABASE command in SQL, it can be automated using PHP. We have already assembled a PHP class for interfacing with our APIs which is available at: http://sdk.cpanel.net/lib/xmlapi/php...p_v.0.1.tar.gz

    I'm moving this post to our Developer Discussions forum since you may receive more relevant responses there.

Similar Threads & Tags
Similar threads

  1. Replies: 10
    Last Post: 01-23-2011, 08:58 AM
  2. MySQL Database Creation
    By thearchitect in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 10-17-2009, 01:31 AM
  3. Remote database creation
    By cagy in forum cPanel Developers
    Replies: 5
    Last Post: 08-21-2009, 02:07 PM
  4. Database creation bug.
    By beddo in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-20-2008, 01:36 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube