Portal Home > Knowledgebase > Articles Database > MySQL GRANT as cPanel User..


MySQL GRANT as cPanel User..




Posted by M_R_W, 05-21-2011, 03:26 PM
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 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).

Posted by nafirici, 05-22-2011, 10:59 AM
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.

Posted by foobic, 05-23-2011, 11:04 PM
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.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
AtomHost.com (Views: 485)