Jump to content


Photo

User priviledges question


  • Please log in to reply
3 replies to this topic

#1 coza73

coza73
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 08 September 2006 - 05:16 AM

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.

#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 08 September 2006 - 07:22 AM

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.

GRANT ALL ON `username\_%`.* TO username@localhost;
GRANT ALL ON `username\_%`.* TO username@localhost.localdomain;

Users by default have access to Db 'test' btw.

#3 coza73

coza73
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 11 September 2006 - 12:06 AM

Worked great, thank you.

;D

#4 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 11 September 2006 - 01:43 AM

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

GRANT ALL ON ... IDENTIFIED BY 'password'





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users