Is it possible in MySQL to do a GRANT to a user on a set of tables within a database, e.g. to allow CREATE AND DROP ing of some table names but not others?
Neither of these seem to work:
GRANT SELECT ON `testdb`.`%_testing` TO 'wildcardtest'@'localhost';
GRANT SELECT ON `testdb`.`testing%` TO 'wildcardtest'@'localhost';
and the MySQL manual doesn't seem to give an answer either way.
解决方案
The only wildcard that works in the GRANT statement is *
GRANT SELECT ON `testdb`.* TO 'user'@'localhost';
GRANT SELECT ON *.* TO 'privilegeduser'@'localhost';
It's all or one; there's no facility for dynamic matching of table names to granted privileges.