在 MySQL 中使用数据库名称通配符 GRANT?

2022-01-04 00:00:00 permissions syntax mysql grant

我想创建一个用户projectA",该用户对名为projectA_%"的每个数据库都具有相同的权限

I want to create a user 'projectA' that has the same permissions to every database named 'projectA_%'

我知道这是可能的,但 MySQL 不喜欢我的语法:

I know its possible but MySQL doesn't like my syntax:

grant all on 'projectA\_%'.* to 'projectA'@'%';

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

推荐答案

如果我在语法中使用 back-tics 而不是单引号,它似乎工作得很好:

If I use back-tics instead of single quotes in the syntax, it appears to work just fine:

grant all on `projectA\_%`.* to `projectA`@`%`;

相关文章