Rechercher dans le manuel MySQL
13.7.1.9 SET DEFAULT ROLE Syntax
For each user
named immediately after
the TO
keyword, this statement defines which
roles become active when the user connects to the server and
authenticates, or when the user executes the
SET ROLE
DEFAULT
statement during a session.
SET DEFAULT ROLE
is alternative
syntax for ALTER
USER ... DEFAULT ROLE
(see
Section 13.7.1.1, “ALTER USER Syntax”). However,
ALTER USER
can set the default
for only a single user, whereas SET DEFAULT
ROLE
can set the default for multiple users. On the
other hand, you can specify CURRENT_USER
as
the user name for the ALTER USER
statement, whereas you cannot for SET
DEFAULT ROLE
.
SET DEFAULT ROLE
requires these
privileges:
Setting the default roles for another user requires the global
CREATE USER
privilege, or theUPDATE
privilege for themysql.default_roles
system 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 in Section 6.2.5, “Specifying Role Names”. For example:
The host name part of the role name, if omitted, defaults to
'%'
.
The clause following the DEFAULT 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 ROLE
is executed.
SET DEFAULT ROLE
and
SET ROLE
DEFAULT
are different statements:
SET DEFAULT ROLE
defines which account roles to activate by default within account sessions.SET ROLE DEFAULT
sets the active roles within the current session to the current account default roles.
For role usage examples, see Section 6.2.10, “Using Roles”.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-set-default-role.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.