CURRENT_ROLE()

Description

Returns the role of the current session.

Syntax

1. SELECT CURRENT_ROLE();

Examples

1. mysql> select current_role();
2. +----------------+
3. | current_role() |
4. +----------------+
5. | moadmin        |
6. +----------------+
7. 1 row in set (0.00 sec)

9. -- Create a role and switch to the new role
10. create role use_role_1;
11. grant all on database * to use_role_1;
12. grant use_role_1 to dump;
13. set role use_role_1;
14. mysql> select current_role();
15. +----------------+
16. | current_role() |
17. +----------------+
18. | use_role_1     |
19. +----------------+
20. 1 row in set (0.00 sec)