LoginSignup
5
5

More than 5 years have passed since last update.

MySQLの特別なデータベース

Last updated at Posted at 2013-06-12

app_で始まるDBに対して権限を付与したいときってちらほらあると思うのですが、どうやって実現すればいいか分からない。
それを調べてる中で、今日初めて知ったこともあったので、一緒にメモ。
# phpmyadminで再現できるんだから出来るはずだよなー、と思いつつ調べるの面倒で調べてなかっただけです。

test_で始まるDBは誰でも何でもできる

調べてくうちに、どうも[test], [test_%]なDBに対しては誰でも何でも出来ることが判明。
ググったらかなり情報出てきたんである種の前提知識っぽいんですけど、恥を忍んでメモ。絶対忘れるし。

もともとの目的

で、まあこっちはかなり単純な話で。

grant all privileges on `app_%`.* to user@localhost identified by 'password';

考えてみればこれでいいんですよね。

130614追記
上のSQLだと、app_testのほかにappaとかにもマッチングしちゃうことに気付きました。

grant all privileges on `app\_%`.* to user@localhost identified by 'password';
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5