Note:
Cockroach Labs supports the current stable release and two releases prior. Therefore, this version will no longer be supported after the Spring 2019 release.

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.
Warning:
Removing a user does not remove that user's privileges. Therefore, to prevent a future user with an identical username from inheriting an old user's privileges, it's important to revoke a user's privileges before or after removing the user.

Required Privileges

The user must have the DELETE privilege on the system.users table.

Synopsis

DROP USER IF EXISTS user_name ,

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

In this example, we first check a user's privileges. We then revoke the user's privileges before removing the user.

copy
icon/buttons/copy
> SHOW GRANTS ON test.customers FOR mroach;
+-----------+--------+------------+
|   Table   |  User  | Privileges |
+-----------+--------+------------+
| customers | mroach | CREATE     |
| customers | mroach | INSERT     |
| customers | mroach | UPDATE     |
+-----------+--------+------------+
(3 rows)
copy
icon/buttons/copy
> REVOKE CREATE,INSERT,UPDATE ON test.customers FROM mroach;
copy
icon/buttons/copy
> DROP USER mroach;

See Also



Yes No