たとえば、サーバーでWA_によって開始されたサーバー上のすべてのデータベースで、特定のユーザーに選択権限を付与したいと思います
次の構文を作成しますが、機能しません
grant select on `wa\_%`.`mytable`
to 'myuser'@'localhost'
identified by '123456';
しかし、それは私にこのエラーを与えます
テーブル wa_%.mytable' が存在しません
MySQL doesn´t allow this type of grants, you can only have wildcards in the database name if you grant privileges on the database or global level. See below exceprt from the 5.5 manual:
The “_” and “%” wildcards are permitted when specifying database names in GRANT statements that grant privileges at the global or database levels.
So for example this will work, because you grant select on database level:
grant select on `wa\_%`.*
to 'myuser'@'localhost'
identified by '123456';
In your example you try to grant access to specific table using wildcard schema name which is not supported by MySQL.
これを試すことができます:
GRANT SELECT ON `wa\_%` . * TO 'myuser'@'localhost' identified by '123456';