MySQL Grant Create and All Privileges on User’s Own Database

MySQL

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)

Best Answer

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.