Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is it possible with mysql to automatically grant an user (which has CREATE privilege) ALL privileges exclusively on her new created databases ? (without manually changing rights after the db is created)

share|improve this question
up vote 3 down vote accepted

It's possible to grant privileges to any database which name is match some mask. Usually I do this for each new user:

GRANT ALL PRIVILEGES ON `userdbname\_%`.* TO `username`@localhost IDENTIFIED BY 'userpass';

After this command user will have all privileges to any database which name match "userdbname_SOMETHING". He also will be able to create any amount of databases at any time which name match this mask.

share|improve this answer
+1; and if you use phpMyAdmin, you can also do this on its graphic user interface: look at "Privileges" tab, "Add a new User". OR with an existing user, you can even "Edit Privileges", so you can modify the user's existing privileges. It's very easy this way. – Sk8erPeter Aug 24 '11 at 13:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.