# DROP ROLE

## Syntax

```bnf
DROP ROLE [IF EXISTS] role_name [,role_name ...]
```

## Description

The `DROP ROLE` statement removes one or more MariaDB [roles](/docs/server/security/user-account-management/roles.md). To use this statement, you must have the global [CREATE USER](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md#create-user) privilege or the [DELETE](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md#table-privileges) privilege for the mysql database.

`DROP ROLE` does not disable roles for connections which selected them with [SET ROLE](/docs/server/reference/sql-statements/account-management-sql-statements/set-role.md). If a role has previously been set as a [default role](/docs/server/reference/sql-statements/account-management-sql-statements/set-default-role.md), `DROP ROLE` does not remove the record of the default role from the [mysql.user](/docs/server/reference/system-tables/the-mysql-database-tables/mysql-user-table.md) table. If the role is subsequently recreated and granted, it will again be the user's default. Use [SET DEFAULT ROLE NONE](/docs/server/reference/sql-statements/account-management-sql-statements/set-default-role.md) 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:

```bnf
ERROR 1396 (HY000): Operation DROP ROLE failed for 'a','b','c'
```

Failed `CREATE` or `DROP` operations, for both users and roles, produce the same error code.

#### IF EXISTS

If the `IF EXISTS` clause is used, MariaDB will return a warning instead of an error if the role does not exist.

## Examples

```sql
DROP ROLE journalist;
```

The same thing using the optional `IF EXISTS` clause:

```sql
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
```

## See Also

* [Roles Overview](/docs/server/security/user-account-management/roles/roles_overview.md)
* [CREATE ROLE](/docs/server/reference/sql-statements/account-management-sql-statements/create-role.md)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/drop-role.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
