Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assign permissions to a user on tables with a certain prefix

Tags:

mysql

I'd like to assign a user all privileges on tables which have a specific prefix, eg. 'abc_'

I'm aware of the use of the wildcard to select all tables thus:

GRANT ALL ON dbname.* TO ...

Essentially, what I'd like to do is:

GRANT ALL ON dbname.abc_* TO ...

This doesn't work so I'm wondering if there is a solution, perhaps using LIKE? (Which I've tried; as yet to no avail).

like image 497
Greg Annandale Avatar asked Nov 27 '25 22:11

Greg Annandale


1 Answers

Nope, sorry. Have to do them one at a time (with, of course, the option to do so programatically).

like image 176
chaos Avatar answered Nov 29 '25 19:11

chaos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!