Remove a role from the system. Learn the syntax to delete defined roles and revoke them from any users or roles that currently hold them.
The DROP ROLE statement removes one or more MariaDB . To use this statement, you must have the global privilege or the privilege for the mysql database.
DROP ROLE does not disable roles for connections which selected them with . If a role has previously been set as a , DROP ROLE does not remove the record of the default role from the table. If the role is subsequently recreated and granted, it will again be the user's default. Use to explicitly remove this.
If any of the specified user accounts do not exist, ERROR 1396 (HY000)results. If an error occurs, DROP ROLE will still drop the roles that do not result in an error. Only one error is produced for all roles which have not been dropped:
Failed CREATE or DROP operations, for both users and roles, produce the same error code.
If the IF EXISTS clause is used, MariaDB will return a warning instead of an error if the role does not exist.
The same thing using the optional IF EXISTS clause:
This page is licensed: CC BY-SA / Gnu FDL
DROP ROLE [IF EXISTS] role_name [,role_name ...]ERROR 1396 (HY000): Operation DROP ROLE failed for 'a','b','c'DROP ROLE journalist;DROP ROLE journalist;
ERROR 1396 (HY000): Operation DROP ROLE failed for 'journalist'
DROP ROLE IF EXISTS journalist;
Query OK, 0 rows affected, 1 warning (0.00 sec)
Note (Code 1975): Can't drop role 'journalist'; it doesn't exist