3

So, I know I can wildcard a database for all tables. For instance if I wanted to grant select to a user for all tables in matching databases, I could:

GRANT SELECT
ON 'databasesprefix%'.*
TO testuser@localhost IDENTIFIED BY 'testpasswd';

However if I wanted to grant UPDATE, DELETE, INSERT to teh user on all matching databases but only for a specific table, the following doesn't work:

GRANT UPDATE, DELETE, INSERT
ON 'databasesprefix%'.specifictable
TO testuser@localhost IDENTIFIED BY 'testpasswd';

Is there a way to doe this in SQL? or will I have to script this externally?

FunkyShu
  • 138
  • 5
  • Why do you have the same table in every database? This suggests a very denormalised schema, which may well be a poor design choice. – eggyal Jan 14 '13 at 17:56
  • Seperate silos for the same application across different customers. I have no control over this design. Just looking to add users with specific permissions. – FunkyShu Jan 14 '13 at 19:35

1 Answers1

1

No. There is no way to do it in MySQL.

http://dev.mysql.com/doc/refman/5.1/en/grant.html

priv_level:
    *
  | *.*
  | db_name.*
  | db_name.tbl_name
  | tbl_name
  | db_name.routine_name

rtm :)

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
fsw
  • 3,595
  • 3
  • 20
  • 34
  • Yep, read the manual but couldn't definitively tell when I read it whether or not both database and table could be wildcarded since thh priv_level you quoted mentions neither the % or _ meta-character wildcards. Thanks for clarifying. – FunkyShu Jan 14 '13 at 19:43