CREATE ROLE
MariaDB starting with 10.0.5
I ruoli sono stati introdotti in MariaDB 10.0.5.
Contents
Sintassi
CREATE ROLE role
[WITH ADMIN {CURRENT_USER | CURRENT_ROLE | utente | ruolo}]
Spiegazione
L'istruzione CREATE ROLE crea uno o più ruoli in MariaDB. Per usarla, occorre disporre del privilegio globale CREATE USER o del privilegio INSERT sul database mysql. Per ogni account, CREATE ROLE crea una nuova riga nella tabella mysql.user che non ha permessi, con il campo is_role impostato a Y. Crea anche un record nella tabella mysql.roles_mapping.
Se uno dei ruoli specificati esiste già, si ottiene un ERROR 1396 (HY000). Se avviene un errore, CREATE ROLE crea i ruoli che non generano errori.
PUBLIC e NONE sono riservati e non possono essere usati come nomi di ruoli.
The optional WITH ADMIN clause determines whether the current user, the current role or another user or role has use of the newly created role. If the clause is omitted, WITH ADMIN CURRENT_USER is treated as the default, which means that the current user will be able to GRANT this role to users.
Esempio
CREATE ROLE journalist; CREATE ROLE developer WITH ADMIN lorinda;