0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【MySQL】ユーザーに権限を設定する(GRANT文)

Posted at

ユーザに権限を設定(GRANT文)

基本の構文

GRANT {{権限1}},{{権限2}} ON {{レベル}} TO {{ユーザ名}};

ユーザ名・・権限を与えるユーザ

権限・・ALL、SELECT、INSERTなど与えたい権限

レベル・・DB、テーブルなど権限を与える範囲を指定

すべての範囲

GRANT ALL ON *.* TO {{ユーザ名}};
GRANT SELECT, INSERT ON *.* TO {{ユーザ名}};

指定のDBのみ

GRANT ALL ON {{DB名}}.* TO {{ユーザ名}};
GRANT SELECT, INSERT ON {{DB名}}.* TO {{ユーザ名}};

指定のテーブルのみ

GRANT ALL ON {{DB名}}.{{テーブル名}} TO {{ユーザ名}};
GRANT SELECT, INSERT ON {{DB名}}.{{テーブル名}} TO {{ユーザ名}};

指定のカラムのみ

GRANT SELECT ({{カラム名}}), INSERT ({{カラム名}}, {{カラム名}}) ON {{DB名}}.{{テーブル名}} TO {{ユーザ名}};
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?