Grant privileges on several tables with specific prefix

后端 未结 4 1481
清歌不尽
清歌不尽 2020-12-08 02:56

I\'m using the table prefix method for having several clients use the same database. The number of tables created per client will be ~55. Instead of doing all of the grant

4条回答
  •  死守一世寂寞
    2020-12-08 03:30

    I'm not sure if you can wildcard table names, you can definitely wildcard database names though. Watch out though as _ is a wildcard matching any single character (like . in a regular expression).

    The Documention is here: http://dev.mysql.com/doc/refman/5.5/en/grant.html

    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; for example, GRANT ... ON `foo\_bar`.* TO ....

提交回复
热议问题