本文介绍了可以在MySQL的GRANT的表名上使用通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中是否有可能对数据库中一组表上的用户进行授予(例如)允许创建和删除某些表名,但不允许其他表名?

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?

这些似乎都不起作用:

GRANT SELECT ON  `testdb`.`%_testing` TO  'wildcardtest'@'localhost';
GRANT SELECT ON  `testdb`.`testing%` TO  'wildcardtest'@'localhost';

并且MySQL手册似乎都没有给出答案.

and the MySQL manual doesn't seem to give an answer either way.

推荐答案

GRANT语句中唯一起作用的通配符是*

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.

这篇关于可以在MySQL的GRANT的表名上使用通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 20:42