gpt4 book ai didi

mysql - 使用 "*"快速授予某些 mysql 数据库表的权限?

转载 作者:行者123 更新时间:2023-11-29 02:57:02 24 4
gpt4 key购买 nike

有没有可能做这样的事情?

GRANT SELECT , INSERT , UPDATE , DELETE ON  `database`.`prefix_*` TO  'user'@'localhost';

这让我可以为每个以“prefix_”开头的表快速设置权限

最佳答案

您可以使用 % 代替 *

GRANT SELECT , INSERT , UPDATE , DELETE ON  `database`.`prefix\_%` TO  'user'@'localhost';

来自docs :

The “_” and “%” wildcards are permitted when specifying database names in GRANT statements that grant privileges at the global or database levels. This means, for example, that if you want to use a “_” character as part of a database name, you should specify it as “_” in the GRANT statement, to prevent the user from being able to access additional databases matching the wildcard pattern;

关于mysql - 使用 "*"快速授予某些 mysql 数据库表的权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29730029/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com