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)

1 Answer 1


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.

  • +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, 2011 at 13:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .