PDF (A4) - 40.5Mb
Man Pages (TGZ) - 259.5Kb
Man Pages (Zip) - 366.7Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb
SET DEFAULT ROLE {NONE | ALL |role [,role ] ...} TOuser [,user ] ... For eachuser named immediately after theTO keyword, this statement defines which roles become active when the user connects to the server and authenticates, or when the user executes theSET ROLE DEFAULT statement during a session.
SET DEFAULT ROLE is alternative syntax forALTER USER ... DEFAULT ROLE (seeSection 15.7.1.1, “ALTER USER Statement”). However,ALTER USER can set the default for only a single user, whereasSET DEFAULT ROLE can set the default for multiple users. On the other hand, you can specifyCURRENT_USER as the user name for theALTER USER statement, whereas you cannot forSET DEFAULT ROLE.
SET DEFAULT ROLE requires these privileges:
Setting the default roles for another user requires the global
CREATE USERprivilege, or theUPDATEprivilege for themysql.default_rolessystem table.Setting the default roles for yourself requires no special privileges, as long as the roles you want as the default have been granted to you.
Each role name uses the format described inSection 8.2.5, “Specifying Role Names”. For example:
SET DEFAULT ROLE 'admin', 'developer' TO 'joe'@'10.0.0.1'; The host name part of the role name, if omitted, defaults to'%'.
The clause following theDEFAULT ROLE keywords permits these values:
NONE: Set the default toNONE(no roles).ALL: Set the default to all roles granted to the account.: Set the default to the named roles, which must exist and be granted to the account at the timerole[,role] ...SET DEFAULT ROLEis executed.
SET DEFAULT ROLE andSET ROLE DEFAULT are different statements:
SET DEFAULT ROLEdefines which account roles to activate by default within account sessions.SET ROLE DEFAULTsets the active roles within the current session to the current account default roles.
For role usage examples, seeSection 8.2.10, “Using Roles”.
PDF (A4) - 40.5Mb
Man Pages (TGZ) - 259.5Kb
Man Pages (Zip) - 366.7Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb