USER_PRIVILEGES

USER_PRIVILEGESは、グローバル権限に関する情報を示します。この情報はmysql.userシステム テーブルから取得されます。

USE INFORMATION_SCHEMA; DESC USER_PRIVILEGES;

出力は次のとおりです。

+----------------+--------------+------+------+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+------+---------+-------+ | GRANTEE | varchar(81) | YES | | NULL | | | TABLE_CATALOG | varchar(512) | YES | | NULL | | | PRIVILEGE_TYPE | varchar(64) | YES | | NULL | | | IS_GRANTABLE | varchar(3) | YES | | NULL | | +----------------+--------------+------+------+---------+-------+ 4 rows in set (0.00 sec)

USER_PRIVILEGESの表の情報をビュー。

SELECT * FROM USER_PRIVILEGES;

出力は次のとおりです。

+------------+---------------+-------------------------+--------------+ | GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE | +------------+---------------+-------------------------+--------------+ | 'root'@'%' | def | SELECT | YES | | 'root'@'%' | def | INSERT | YES | | 'root'@'%' | def | UPDATE | YES | | 'root'@'%' | def | DELETE | YES | | 'root'@'%' | def | CREATE | YES | | 'root'@'%' | def | DROP | YES | | 'root'@'%' | def | PROCESS | YES | | 'root'@'%' | def | REFERENCES | YES | | 'root'@'%' | def | ALTER | YES | | 'root'@'%' | def | SHOW DATABASES | YES | | 'root'@'%' | def | SUPER | YES | | 'root'@'%' | def | EXECUTE | YES | | 'root'@'%' | def | INDEX | YES | | 'root'@'%' | def | CREATE USER | YES | | 'root'@'%' | def | CREATE TABLESPACE | YES | | 'root'@'%' | def | TRIGGER | YES | | 'root'@'%' | def | CREATE VIEW | YES | | 'root'@'%' | def | SHOW VIEW | YES | | 'root'@'%' | def | CREATE ROLE | YES | | 'root'@'%' | def | DROP ROLE | YES | | 'root'@'%' | def | CREATE TEMPORARY TABLES | YES | | 'root'@'%' | def | LOCK TABLES | YES | | 'root'@'%' | def | CREATE ROUTINE | YES | | 'root'@'%' | def | ALTER ROUTINE | YES | | 'root'@'%' | def | EVENT | YES | | 'root'@'%' | def | SHUTDOWN | YES | | 'root'@'%' | def | RELOAD | YES | | 'root'@'%' | def | FILE | YES | | 'root'@'%' | def | CONFIG | YES | | 'root'@'%' | def | REPLICATION CLIENT | YES | | 'root'@'%' | def | REPLICATION SLAVE | YES | +------------+---------------+-------------------------+--------------+ 31 rows in set (0.00 sec)
+------------+---------------+-------------------------+--------------+ | GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE | +------------+---------------+-------------------------+--------------+ | 'root'@'%' | def | SELECT | YES | | 'root'@'%' | def | INSERT | YES | | 'root'@'%' | def | UPDATE | YES | | 'root'@'%' | def | DELETE | YES | | 'root'@'%' | def | CREATE | YES | | 'root'@'%' | def | DROP | YES | | 'root'@'%' | def | PROCESS | YES | | 'root'@'%' | def | REFERENCES | YES | | 'root'@'%' | def | ALTER | YES | | 'root'@'%' | def | SHOW DATABASES | YES | | 'root'@'%' | def | SUPER | YES | | 'root'@'%' | def | EXECUTE | YES | | 'root'@'%' | def | INDEX | YES | | 'root'@'%' | def | CREATE USER | YES | | 'root'@'%' | def | CREATE TABLESPACE | YES | | 'root'@'%' | def | TRIGGER | YES | | 'root'@'%' | def | CREATE VIEW | YES | | 'root'@'%' | def | SHOW VIEW | YES | | 'root'@'%' | def | CREATE ROLE | YES | | 'root'@'%' | def | DROP ROLE | YES | | 'root'@'%' | def | CREATE TEMPORARY TABLES | YES | | 'root'@'%' | def | LOCK TABLES | YES | | 'root'@'%' | def | CREATE ROUTINE | YES | | 'root'@'%' | def | ALTER ROUTINE | YES | | 'root'@'%' | def | EVENT | YES | | 'root'@'%' | def | RELOAD | YES | | 'root'@'%' | def | FILE | YES | | 'root'@'%' | def | REPLICATION CLIENT | YES | | 'root'@'%' | def | REPLICATION SLAVE | YES | +------------+---------------+-------------------------+--------------+ 29 rows in set (0.00 sec)

USER_PRIVILEGESテーブルのフィールドは次のように説明されています。

  • GRANTEE : 許可されたユーザーの名前。形式は'user_name'@'host_name'です。
  • TABLE_CATALOG : テーブルが属するカタログの名前。この値は常にdefです。
  • PRIVILEGE_TYPE : 付与される権限のタイプ。各行には 1 つの権限タイプのみが表示されます。
  • IS_GRANTABLE : GRANT OPTION権限がある場合、値はYESです。それ以外の場合、値はNOです。

このページは役に立ちましたか?

Playground
新規
登録なしで TiDB の機能をワンストップでインタラクティブに体験できます。
製品
TiDB Cloud
TiDB
価格
PoC お問い合わせ
エコシステム
TiKV
TiFlash
OSS Insight
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.