Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: MYSql Capabilities
PostPosted: Wed Aug 15, 2012 12:24 am 
Offline
Junior Member

Joined: Tue May 31, 2011 5:28 pm
Posts: 25
Hello all.
I need some help configuring mysql. When creating a user, I noticed that I cannot create a user that was allowed to create, edit, or delete their own dbs unless I grant them those capabilities. When I do grant them those capabilities, they were able to access all the other db that they didn't own. How can I limit their access to only their dbs and give them the ability to create, edit, and delete only their dbs.

Is it by adding a host? so that they're all not just from localhost? If so, how do I get that to work? I've added the host and assigned the user to the host; but when accessing the db with that username, I can't access it with the host domain nor can I access mysql using localhost. I hope I am clear.

I would also appreciate the help. Thanks

John


Top
   
 Post subject: Re: MYSql Capabilities
PostPosted: Wed Aug 15, 2012 12:41 am 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
#mysql -u root -p <then enter mysqld root password>
> Create Database databasename; (should respond OK)
>Grant ALL privileges on databasename.* to username@localhost Identified by “user-password”;
(should respond OK)
>Flush Privileges; (should respond OK)
> Exit (should respond with BYE)

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
 Post subject: Re: MYSql Capabilities
PostPosted: Wed Aug 15, 2012 12:47 am 
Offline
Junior Member

Joined: Tue May 31, 2011 5:28 pm
Posts: 25
Yes, this is exactly what I did; however that user isn't able to create another database nor delete another databases that was created by that user.

The goal is to have the user create his own databases and also be able to edit and delete the user's created databases without having the power to edit or delete another user's databases.

Thanks!


Top
   
 Post subject: Re: MYSql Capabilities
PostPosted: Wed Aug 15, 2012 1:47 am 
Offline
Senior Member

Joined: Tue May 03, 2011 11:55 am
Posts: 105
You can do something like this:

GRANT ALL PRIVILEGES ON `dbprefix_%` . * TO 'user'@'localhost';

This should allow them to create/delete any database with name of the form "dbprefix_<something>".
I don't think there is a way to restrict a MySQL user to being able to delete only databases that they create. Meaning that if they can create a database with any name, they can also delete one with any name (I.E. they have root powers now).


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group