hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : MySQL GRANT as cPanel User..
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

MySQL GRANT as cPanel User..

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 05-21-2011, 03:26 PM
M_R_W M_R_W is offline
Junior Guru Wannabe
 
Join Date: Jun 2010
Posts: 51

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
Code:
GRANT ALL PRIVILEGES ON cpaneluser_db.* TO cpaneluser_dbuser@localhost IDENTIFIED BY 'dbuserpassword';
Always gives me Access Denies cpaneluser@localhost 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).

Reply With Quote


Sponsored Links
  #2  
Old 05-22-2011, 10:59 AM
nafirici nafirici is offline
Junior Guru Wannabe
 
Join Date: Mar 2011
Posts: 42
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.

__________________
Nafirici | WI Real Estate


Last edited by nafirici; 05-22-2011 at 11:00 AM. Reason: add clairification.
Reply With Quote
  #3  
Old 05-23-2011, 11:04 PM
foobic foobic is offline
Community Liaison 2.0
 
Join Date: Feb 2005
Location: Australia
Posts: 5,111
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.

__________________
Chris

"Learn from the mistakes of others. You can never live long enough to make them all yourself." - Groucho Marx

Reply With Quote
Sponsored Links
Reply

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

Related posts from TheWhir.com
Title Type Date Posted
Hosting Control Panel cPanel & WHM 11.34 Release Hits Stable Tier Web Hosting News 2012-11-12 17:04:57
cPanel Releases cPanel, WHM 11.34 with New User Interface Web Hosting News 2012-10-16 13:09:49
cPanel Conference 2012: Branding and How to Do it Better with Felipe Gasper Web Hosting News 2012-10-09 18:00:02
Web Hosting Control Panel cPanel and WHM Version 11.32 Adds Features, Fixes Web Hosting News 2012-04-08 11:51:35
cPanel Launches Version 11.32 of Control Panel and Web Host Manager Web Hosting News 2012-02-15 12:46:33


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?