Portal Home > Knowledgebase > Articles Database > Connect to MySQL DB only on certain user?


Connect to MySQL DB only on certain user?




Posted by iUnknown, 04-20-2009, 12:18 PM
Hi, I am using cPanel 11 (stable release) on a CentOS 5 server and would like to make it so that a particular database can only be connected to from the cPanel user that it is under (ie. user1_db can only be connected to from the user "user1" on the same server). Is this possible? Thanks.

Posted by ServerManagement, 04-20-2009, 01:06 PM
You can set the mysql user priviledges and databases assigned to it in the mysql section inside cpanel. You can choose which user has access to a database and what priviledges it has.

Posted by iUnknown, 04-20-2009, 01:09 PM
Sorry if I have not made this clear. I mean that if you login with the correct db name, db user, db password, it won't make a difference. You must be connecting from a particular server user (ie. anywhere in /home/user1/public_html). If you try connecting from anywhere else, even another place on the server, it will not work. That is what I want to achieve.

Posted by jNive, 04-20-2009, 03:47 PM
by default cpanel will configure every database created as accessible only from the configured db user and only from the the localhost, you might want to double check the priveleges created for the root/parent level though (i believe the users are created with USE permission on . )

Posted by iUnknown, 04-20-2009, 04:04 PM
You still do not understand what I mean. If I upload a script in the cPanel account of user2 and enter the mysql databases for a database and database user starting with user1_ ... it still lets me connect. I want it so that only the script uploaded to the cPanel account of user1 to be able to connect to user1_

Posted by The Universes, 04-20-2009, 05:25 PM
I think I understand what your saying. Basically MySQL has user1 and user2, which also happens to correspond to user1 and user2 in cPanel and you want it to that user1 cannot connect to the MySQL using user2's credentials and vice-versa. Thats not really possible.

Posted by iUnknown, 04-20-2009, 05:30 PM
That's correct as to what I want (kind of)... surely there is a way?

Posted by darkeden, 04-20-2009, 05:38 PM
theres one way. dont share your password with anyone XD

Posted by iUnknown, 04-20-2009, 05:40 PM
Other than that...

Posted by The Universes, 04-20-2009, 05:40 PM
so yeah.....



Was this answer helpful?

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

Also Read
ATJEU.com down ... (Views: 684)
QuickPacket own (Views: 743)
Msn (Views: 712)
Dealing with pfsense (Views: 613)
sonataweb.net down? (Views: 706)

Language: