On this page
Warning:
CockroachDB v1.1 is no longer supported as of April 12, 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.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
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.
> 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;