> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DROP ROLE

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `DROP ROLE` <InternalLink path="sql-statements">statement</InternalLink> removes one or more SQL roles. You can use the keywords `ROLE` and `USER` interchangeably. <InternalLink path="drop-user">`DROP USER`</InternalLink> is an alias for `DROP ROLE`.

<Note>
  The \`\` statement performs a schema change. For more information about how online schema changes work in CockroachDB, see <InternalLink path="online-schema-changes">Online Schema Changes</InternalLink>.
</Note>

## Considerations

* The `admin` user/role cannot be dropped, and `root` must always be a member of `admin`.
* A user/role cannot be dropped if it has privileges. Use <InternalLink path="revoke">`REVOKE`</InternalLink> to remove privileges.
* Users/roles that <InternalLink path="security-reference/authorization#object-ownership">own objects</InternalLink> (such as databases, tables, schemas, and types) cannot be dropped until the <InternalLink path="alter-database">ownership is transferred to another user/role</InternalLink>.
* If a user/role is logged in while a <InternalLink path="show-sessions">different session</InternalLink> drops that user, CockroachDB checks that the user exists before allowing it to inherit privileges from <InternalLink path="security-reference/authorization">the `public` role</InternalLink>. In addition, any active <InternalLink path="ui-overview#authentication">web</InternalLink> <InternalLink path="cockroach-auth-session">sessions</InternalLink> are revoked when a user is dropped.

## Required privileges

Non-admin roles cannot drop admin roles. To drop non-admin roles, the role must be a member of the `admin` role or have the <InternalLink path="create-role#create-a-role-that-can-create-other-roles-and-manage-authentication-methods-for-the-new-roles">`CREATEROLE`</InternalLink> parameter set.

## Synopsis

<img src="https://mintcdn.com/cockroachlabs/uBcLAizjWFXF4pfd/images/sql-diagrams/v25.1/drop_role.svg?fit=max&auto=format&n=uBcLAizjWFXF4pfd&q=85&s=63a575ddaff9cae64fa7bac9cd8c59ba" alt="drop_role syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="545" height="81" data-path="images/sql-diagrams/v25.1/drop_role.svg" />

## Parameters

| Parameter | Description                                                                                                                                                                                                  |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `name`    | The name of the role to remove. To remove multiple roles, use a comma-separate list of roles.<br /><br />You can use <InternalLink path="show-roles">`SHOW ROLES`</InternalLink> to find the names of roles. |

## Example

In this example, first check a role's privileges. Then, revoke the role's privileges and remove the role.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW GRANTS ON documents FOR dev_ops;
```

```
+------------+--------+-----------+---------+------------+
|  Database  | Schema |   Table   |  User   | Privileges |
+------------+--------+-----------+---------+------------+
| jsonb_test | public | documents | dev_ops | INSERT     |
+------------+--------+-----------+---------+------------+
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> REVOKE INSERT ON documents FROM dev_ops;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> DROP ROLE dev_ops;
```

## See also

* <InternalLink path="authorization">Authorization</InternalLink>
* <InternalLink path="security-reference/authorization#authorization-best-practices">Authorization Best Practices</InternalLink>
* <InternalLink path="create-role">`CREATE ROLE`</InternalLink>
* <InternalLink path="show-roles">`SHOW ROLES`</InternalLink>
* <InternalLink path="grant">`GRANT`</InternalLink>
* <InternalLink path="show-grants">`SHOW GRANTS`</InternalLink>
* <InternalLink path="sql-statements">SQL Statements</InternalLink>
* <InternalLink path="online-schema-changes">Online Schema Changes</InternalLink>
