# Using Roles

__*zz-BGL*__
__*zz-Jeff*__

+ Role name is case-sensitive
+ Role has no password
+ Role information is stored in the **`mysql.user`** table and the **`account_locked`** field is always **`Y`**
+ When a user logs in, the **`SET ROLE`** command must be used to enable the user's assigned roles
  + For example:

```
SET ROLE ~!@ALL@!~;
SET ROLE <role_name>, <role_name>, ...;
SET ROLE ~!@ALL EXCEPT@!~ <role_name>, <role_name>, ...;
SET ROLE ~!@DEFAULT@!~;
SET ROLE ~!@NONE@!~;
```

-------------------------------------------------------------
Roles are stored in the `mysql.user` table and the host name part of the role name (if omitted) defaults to `'%'`.

You can use `SHOW GRANTS` or `SHOW GRANTS FOR CURRENT_USER()` to check the current user's privileges. `SHOW GRANTS` and `SHOW GRANTS FOR CURRENT_USER()` are different in the following aspects:
-` SHOW GRANTS` shows the privilege of the enabled role for the current user.
- `SHOW GRANTS FOR CURRENT_USER()` does not show the enabled role's privilege.
