On this page
Warning:
CockroachDB v2.0 is no longer supported as of October 4, 2019. For more details, refer to the Release Support Policy.
New in v1.1: The DROP USER
statement removes one or more SQL users.
Tip:
You can also use the cockroach user rm
command to remove users.Required Privileges
The user must have the DELETE
privilege on the system.users
table.
Synopsis
Parameters
Parameter | Description |
---|---|
user_name |
The username of the user to remove. To remove multiple users, use a comma-separate list of usernames. You can use SHOW USERS to find usernames. |
Example
New in v2.0: All of a user's privileges must be revoked before the user can be dropped.
In this example, first check a user's privileges. Then, revoke the user's privileges before removing the user.
> SHOW GRANTS ON test.customers FOR mroach;
+-----------+--------+------------+
| Table | User | Privileges |
+-----------+--------+------------+
| customers | mroach | CREATE |
| customers | mroach | INSERT |
| customers | mroach | UPDATE |
+-----------+--------+------------+
(3 rows)
> REVOKE CREATE,INSERT,UPDATE ON test.customers FROM mroach;
> DROP USER mroach;