February 2018
Intermediate to advanced
510 pages
16h 10m
English
SET ROLE changes the active roles within the current session. Refer to the following commands related to SET ROLE:
mysql> SET ROLE NONE; SELECT CURRENT_ROLE();+----------------+| CURRENT_ROLE() |+----------------+| NONE |+----------------+mysql> SET ROLE 'developer_read'; SELECT CURRENT_ROLE();+----------------+| CURRENT_ROLE() |+----------------+| `developer_read`@`%` |+----------------+
The first command will deactivate all roles for the user in the current session. You can see the effect with the CURRENT_ROLE(); function. In the second command, we are setting the 'developer_read' role as default, and then checking the current role using the predefined function again.
Read now
Unlock full access