|
I think that set-default-role may have better example and a context, with adding note that default_role as each role should be granted first (in second paragraph) to the user in order to have effect.
Example could be:
CREATE ROLE test_role;
|
CREATE USER test_user;
|
SET DEFAULT ROLE test_role FOR test_user; #error, role not granted
|
GRANT test_role TO test_user; # ok
|
SET DEFAULT ROLE test_role FOR test_user;
|
# Get list of roles
|
SELECT * FROM mysql.roles_mapping;
|
# Or from mysql.user where default_role=Y
|
SELECT * FROM mysql.user where default_role='Y';
|
|