Jump to content

User priviledges question


coza73

Recommended Posts

Is it possible to setup a mysql user to be able to create new databases but only be able to access/edit/see their own databases, and none of the existing databases or ones created by other users?

i.e multible uses on one server creating, editing and removing their own databases with no access to any other databases on the server. And root to have global access to all databases created.

Thanks.
Link to comment
Share on other sites

The following GRANT should allow the users to create databases starting with "username_" and unless there's an error already in the permissions, users shouldn't be able to see databases they haven't been given explicit access to.

[code]
GRANT ALL ON `username\_%`.* TO username@localhost;
GRANT ALL ON `username\_%`.* TO username@localhost.localdomain;
[/code]

Users by default have access to Db 'test' btw.
Link to comment
Share on other sites

I should also mention that if you're adding new users you'll want to also add
[code]
IDENTIFIED BY 'password here'
[/code]
to the end of the GRANT statement or you'll create users with blank passwords.

[code]
GRANT ALL ON ... IDENTIFIED BY 'password'
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.