# Create a Role

__*TiDB Create Roles*__

+ Created 2 roles r*admin and r*dev @localhost:
+ `create role 'r_admin', 'r_dev’@’localhost'     -'r_dev':user_name is case sensitive  -'localhost':host_name can be a hostname or IP address`

+ Defaults to '%' if hostname is ignored
+ The similarities between roles and users are:
  + It's locked (locked)
  + No password
  + Stored in the mysql.user table
  + When a user logs in, the set role all command must be used to enable the user's assigned roles.

-------------------------------------------------------------
With the following statement, we have created 2 roles r*admin and r*dev @localhost.

create role 'r*admin', 'r*dev' @'localhost'

For r_admin, the default is'% 'if the hostname is ignored.

The similarities between roles and users are:
1. It's locked (locked)
2. No password
3. Stored in the mysql.user table

For detailed operation, please refer to: https://docs.pingcap.com/zh/tidb/stable/role-based-access-control