LoginSignup
6
5

More than 5 years have passed since last update.

MySQLユーザ作成 [memo]

Last updated at Posted at 2017-04-05

ユーザー情報の確認

select Host, User, Password from mysql.user;

ユーザー追加

GRANT <権限> ON <適用範囲> TO <ユーザー名>[@<ホスト名>] IDENTIFIED BY '<パスワード>';
  • ReadOnlyユーザー追加
GRANT SELECT
ON [DB name].* to 'username'@'localhost'
IDENTIFIED BY 'jaLMw8&5nfzN_#4y';

ユーザー権限確認

SHOW GRANTS FOR 'username'@'localhost';

ユーザー削除

DROP USER 'username'@'localhost';

権限の確認

SHOW GRANTS FOR 'ユーザ名'@'ホスト名';

権限の付与

GRANT ALL PRIVILEGES ON `DB名`.テーブル TO 'ユーザ名'@'ホスト名';
GRANT SELECT,UPDATE,INSERT,DELETE ON `DB名`.テーブル TO 'ユーザ名'@'ホスト名';
6
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
6
5