MYSql Capabilities
I need some help configuring mysql. When creating a user, I noticed that I cannot create a user that was allowed to create, edit, or delete their own dbs unless I grant them those capabilities. When I do grant them those capabilities, they were able to access all the other db that they didn't own. How can I limit their access to only their dbs and give them the ability to create, edit, and delete only their dbs.
Is it by adding a host? so that they're all not just from localhost? If so, how do I get that to work? I've added the host and assigned the user to the host; but when accessing the db with that username, I can't access it with the host domain nor can I access mysql using localhost. I hope I am clear.
I would also appreciate the help. Thanks
John
3 Replies
Grant ALL privileges on databasename.* to username@localhost Identified by “user-password”;
(should respond OK)
Flush Privileges; (should respond OK)
Exit (should respond with BYE)
The goal is to have the user create his own databases and also be able to edit and delete the user's created databases without having the power to edit or delete another user's databases.
Thanks!
GRANT ALL PRIVILEGES ON dbprefix_%
. * TO 'user'@'localhost';
This should allow them to create/delete any database with name of the form "dbprefix_
I don't think there is a way to restrict a MySQL user to being able to delete only databases that they create. Meaning that if they can create a database with any name, they can also delete one with any name (I.E. they have root powers now).