Note
This view is available starting with V4.0.0.
Purpose
This view displays column privilege information.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| GRANTEE | varchar(292) | NO | The name of the user who has been granted access. |
| TABLE_CATALOG | varchar(512) | NO | The name of the directory to which the table containing the column belongs. This value is always def. |
| TABLE_SCHEMA | varchar(64) | NO | The name of the database to which the table containing the column belongs. |
| TABLE_NAME | varchar(64) | NO | The name of the table that contains the column. |
| COLUMN_NAME | varchar(64) | NO | The name of the column. |
| PRIVILEGE_TYPE | varchar(64) | NO | The privilege granted. This value can be any privilege granted at the column level. |
| IS_GRANTABLE | varchar(3) | NO |
|
Sample query
Query the column privileges of a user.
obclient [information_schema]> SELECT * FROM information_schema.COLUMN_PRIVILEGES;
The query result is as follows:
+-------------+---------------+--------------+------------+-------------+----------------+--------------+
| GRANTEE | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | PRIVILEGE_TYPE | IS_GRANTABLE |
+-------------+---------------+--------------+------------+-------------+----------------+--------------+
| 'user2'@'%' | def | test1 | tbl1 | c1 | INSERT | YES |
| 'user1'@'%' | def | test1 | tbl1 | c1 | SELECT | NO |
+-------------+---------------+--------------+------------+-------------+----------------+--------------+
2 rows in set
References
Query the column privileges granted to a user: mysql.columns_priv