0

I'm trying to grant access one user to many db that have been created on my system like this:

dbUser_1 dbUser_2 ...

and so on.

I can use GRANT SELECT, INSERT, UPDATE ON `dbUser\_%`.* TO 'kenny'@'localhost'; To let kenny user to insert, select and update ALLL the table of each db.

I'm looking for make something like this: ATENTION, this don't work: GRANT SELECT, INSERT, UPDATE ON `dbUser\_%`.*`bill` TO 'kenny'@'localhost';

To let kenny get access to all the bill tables on each db.

¿It is possible?

I'm using mysql. Thanks in advance.

Antonio
  • 58
  • 6

1 Answers1

0

You can use this:

GRANT SELECT, INSERT, UPDATE ON DBNAME.TABLE_NAME TO USERNAME

So it will be something like this:

GRANT SELECT, INSERT, UPDATE ON dbUser\_%.* TO 'kenny'@'localhost';

For more check: https://dev.mysql.com/doc/refman/5.7/en/grant.html

Update: When specifying a table level privilege, wildcards in the DB are treated as the character _ and %. They are not wildcards anymore. See the GRANT documentation under "Object Quoting Guidelines" (@mhost)

  • Hi Voli, this answer don't works for me because i'm looking for Grant access to all the db with the same prefix (dbUser_1, dbUser_2 ...) but only one of the tables of each database (`bill`) When I try to Grant with wildcards, the system tell me that the "Table doesn't exist"... I need this solution to let the future db of the sistem be updated by this user. Thanks for your aswer. – Antonio May 27 '20 at 15:06
  • I can only redirect you to this: https://stackoverflow.com/questions/2668591/grant-with-database-name-wildcard-in-mysql/2668660#comment100527739_2668660 Sorry that I couldn't help you with this :) – Voli Runbekcisi May 29 '20 at 14:30