Thread: MySQL GRANT as cPanel User..
05-21-2011, 03:26 PM #1Junior Guru Wannabe
- 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';
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).
05-22-2011, 10:59 AM #2Junior Guru Wannabe
- 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.
05-23-2011, 11:04 PM #3Retired Moderator
- Join Date
- Feb 2005
I believe you have two choices:
- 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.
- 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
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
By jayzee in forum Hosting Security and TechnologyReplies: 11Last Post: 06-04-2007, 09:30 PM
By hostchamp in forum Hosting Security and TechnologyReplies: 11Last Post: 02-15-2005, 03:12 PM
By hostchamp in forum Programming DiscussionReplies: 5Last Post: 07-09-2004, 05:45 AM