Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010

    MySQL GRANT as cPanel User..

    Im currently writing a small bash script that will automatically create databases, grant privileges, unzip a file and then import a sqldump...

    Im having problems granting permissions to databases using cPanel users, rather than root..

    As I dont have root access to my companies servers, everything needs to be done using the cpanel users password.

    Logging into MySQL (Using a cpanel users details) via ssh and running
    GRANT ALL PRIVILEGES ON cpaneluser_db.* TO [email protected] IDENTIFIED BY 'dbuserpassword';
    Always gives me Access Denies [email protected] to cpaneluser_db (I have also tried GRANT SELECT, INSERT etc.)

    Is there any way of granting persimissions to a database without logging in as root, and without having to go through cPanel itself? (As I dont have root access, I cant modify the mysql.user table).

  2. #2
    Join Date
    Mar 2011
    the user that you're logged in as needs the GRANT priv on the host that you're in. See the localhost part, that's probably the cause of the issue. You probably don't have grant from localhost. Also, this script sounds like a security issue, make sure it's locked down tight if you decide to continue with it.
    Last edited by nafirici; 05-22-2011 at 11:00 AM. Reason: add clairification.

  3. #3
    Join Date
    Feb 2005
    I believe you have two choices:
    1. Ask your system admin to create a new mysql user for you with grant and create database privileges. This will be outside of the cpanel system but the new mysql admin user doesn't need to be associated with the root login.
    2. Have your program create the databases and db-users through the cPanel API.

    I'd suggest (2). My concern with (1) would be whether the databases and users you set up would be recognised by cPanel. Your system would need to comply with the cPanel naming convention (cpaneluser_dbname, cpaneluser_dbuser) of course, but IDK whether cPanel keeps any other record of databases and users.

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

Similar Threads

  1. Grant priviledge for a user to a database via bash scripting
    By jayzee in forum Hosting Security and Technology
    Replies: 11
    Last Post: 06-04-2007, 09:30 PM
  2. MySQL - How to grant FILE privilege?
    By hostchamp in forum Hosting Security and Technology
    Replies: 11
    Last Post: 02-15-2005, 03:12 PM
  3. MySQL 4.0: How to create user with correct Grant previleges ?
    By hostchamp in forum Programming Discussion
    Replies: 5
    Last Post: 07-09-2004, 05:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts