开发者

set permissions on users mysql with wildcard?

开发者 https://www.devze.com 2023-01-07 03:39 出处:网络
normally one would say: GRANT ALL PRIVILEGES ON . TO \'monty\'@\'%\' Can we use a wildcard where we can target specific databases only like this:

normally one would say:

GRANT ALL PRIVILEGES ON . TO 'monty'@'%'

Can we use a wildcard where we can target specific databases only like this:

GRANT ALL PRIVILEGES ON SHOP%.* TO 'monty'@'%'

We would like to give insert privileges to开发者_C百科 a user on databases that start with prefix "SHOP"


Yes, you can. See the GRANT Syntax. Here's a quote from that page:

The “_” and “%” wildcards are allowed 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; for example, GRANT ... ON `foo\_bar`.* TO

0

精彩评论

暂无评论...
验证码 换一张
取 消