TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

USER_ATTRIBUTES

The USER_PRIVILEGES table provides information about user comments and user attributes. This information comes from the mysql.user system table.

USE information_schema; DESC user_attributes;
+-----------+--------------+------+------+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+------+---------+-------+ | USER | varchar(32) | NO | | NULL | | | HOST | varchar(255) | NO | | NULL | | | ATTRIBUTE | longtext | YES | | NULL | | +-----------+--------------+------+------+---------+-------+ 3 rows in set (0.00 sec)

Fields in the USER_ATTRIBUTES table are described as follows:

  • USER: The user name.
  • HOST: The host from which the user can connect to TiDB. If the value of this field is , it means that the user can connect to TiDB from any host.
  • ATTRIBUTE: The comment and attribute of the user, which are set by the CREATE USER or ALTER USER statement.

The following is an example:

CREATE USER testuser1 COMMENT 'This user is created only for test'; CREATE USER testuser2 ATTRIBUTE '{"email": "user@pingcap.com"}'; SELECT * FROM information_schema.user_attributes;
+-----------+------+---------------------------------------------------+ | USER | HOST | ATTRIBUTE | +-----------+------+---------------------------------------------------+ | root | % | NULL | | testuser1 | % | {"comment": "This user is created only for test"} | | testuser2 | % | {"email": "user@pingcap.com"} | +-----------+------+---------------------------------------------------+ 3 rows in set (0.00 sec)

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.