# Managing User Account

__*TiDB account management*__

+ Grant the user privilege to read all tables in the test database:
  + `grant read on 'test'.* to 'user1'@'localhost' with grant option;`

+ Give the user full privilege:
  + `grant all privileges on *.* to 'user2'@'localhost' with grant option;`

+ Reclaim all user privilege:
  + `revoke all privileges on *.* from 'user2'@'localhost';`

+ To view user privileges:
  + `show grants for 'admin'@'localhost';`

+ To delete a user:
  + `drop user 'user3'@'localhost';`

-------------------------------------------------------------
1. Grant the user privilege to read all tables in the test database:
GRANT READ ON 'test'.* TO' user1'@'localhost' WITH GRANT OPTION;
Note: WITH GRANT OPTION indicates that 'user1' @'localhost' can grant other users privilege to read all tables in the test database.

2. Give the user full privilege:
GRANT ALL PRIVILEGES ON *.* TO 'user2' @'localhost' WITH GRANT OPTION;

3. Reclaim all user privilege:
REVOKE ALL PRIVILEGES ON *.* FROM 'user2' @'localhost';

4. To view user privileges:
SHOW GRANTS FOR 'admin' @'localhost';
+—+
| Grants for admin @localhost |
+—+
| GRANT RELOAD, PROCESS ON *.* TO 'admin' @'localhost' |
+—+

5. To delete a user:
DROP USER 'user3' @'localhost';
This action clears the user's entries in the mysql.user table and clears the associated records in the authorization table.

For detailed operation, please refer to: https://docs.pingcap.com/zh/tidb/stable/user-account-management