im creating a few users: user1 user2 user3 i want to give them ALL PRIVILEGES to the bases(creating/removing) inside their account i want them to see and affect databases only inside their account... how should i do this with shell ?
Asked
Active
Viewed 123 times
-1
-
Are you asking how to grant the privileges in the database, or are you asking how to write a shell script that iterates over the users? – Barmar May 29 '19 at 22:11
-
For the first part, you should ask in [dba.se]. – Barmar May 29 '19 at 22:11
1 Answers
1
Do you allow users to run CREATE DATABASE ...
?
Don't allow a user to run that SQL. Instead, provide a STORED PROCEDURE
to create the database for him and provide permissions to him. The trick is to be root
when you define the SP and use SQL SECURITY DEFINER
. And have GRANT ALL PRIVILEGES ON dbname.* TO user@...
(with the pieces suitably filled in).

Rick James
- 135,179
- 13
- 127
- 222