MySQL - Grant Users Ability To Create Own Database

If you want to allow third parties to use your MySQL server, but dont have a management tool such as cPanel, then you can easily allow users to create their own databases by running the following command as the administrator.

GRANT ALL PRIVILEGES ON `prefix_%`.* TO 'user'@'%';
It is an extremely good idea to keep the prefix the same as the user for ease of use and avoiding potential "collisions". The last thing you want is for users to be able to see each other's databases by accident.

If you just want to create another administrator user, you can give the user the ability to grant privileges as well with the following command:

GRANT ALL PRIVILEGES ON `prefix_%`.* TO 'user'@'%' WITH GRANT OPTION;

References

No comments:

Post a Comment