28.3.46 The INFORMATION_SCHEMA USER_ATTRIBUTES Table (original) (raw)

28.3.46 The INFORMATION_SCHEMA USER_ATTRIBUTES Table

The USER_ATTRIBUTES table (available as of MySQL 8.0.21) provides information about user comments and user attributes. It takes its values from themysql.user system table.

The USER_ATTRIBUTES table has these columns:

Notes

mysql> SELECT ATTRIBUTE->>"$.comment" AS Comment  
    ->     FROM INFORMATION_SCHEMA.USER_ATTRIBUTES  
    ->     WHERE USER='bill' AND HOST='localhost';  
+-----------+  
| Comment   |  
+-----------+  
| A comment |  
+-----------+  

Similarly, you can obtain the unquoted value for a given user attribute using its key.

For more information about specifying account comments and attributes, see Section 15.7.1.3, “CREATE USER Statement”.