Grant on multiple databases. MySQL

后端 未结 2 1473
迷失自我
迷失自我 2020-12-30 10:24

How to grant on multiple databases? MySQL.

Something like

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE
ON \'databasesprefix%\'.*
TO testuser@localhost ID         


        
2条回答
  •  -上瘾入骨i
    2020-12-30 11:08

    your example should work. from the (5.5) manual:

    The “_” and “%” wildcards are allowed when specifying database names in GRANT statements that grant privileges at the global or database levels.

    with % matching any number (even zero) of characters, and _ matching exactly one character. if you want a _ in your database name, you have to escape it as \_. also watch the other caveats from the manual.

    <UPDATE>as the other answer points out: if the database name contains wildcards, it has to be quoted with the identifier quote character, the backtick (“`”)UPDATE>

提交回复
热议问题