CREATE USER, ALTER USER, GRANT, and DROP USER let you add, modify, privilege, and remove accounts in ClickHouse.
Separate users isolate query history, resource quotas, and data-access rights, simplifying audit and security reviews.
Run CREATE USER john IDENTIFIED BY 'S3cur3!'
. The account is created instantly and can be granted permissions next.
First create the role, then grant it: GRANT SELECT ON ecommerce.Orders TO john
. The user can now query order data but not modify it.
Yes.Use wildcards or schemas: GRANT SELECT ON ecommerce.* TO analyst_role
and then GRANT analyst_role TO john
.
Execute ALTER USER john IDENTIFIED BY 'N3wP@ss'
. The new credential is active immediately; no service restart required.
Remove access fast with DROP USER IF EXISTS john
. All active sessions terminate, and privileges disappear.
Create roles like readonly_orders
and grant them to users.This centralizes privilege management and prevents drift.
Store secrets in users.xml
with environment variable substitution or use LDAP/OAuth plugins instead of plaintext SQL.
.
No built-in flag exists. Instead, set a temporary strong password with ALTER USER
and communicate it securely.
Attach a QUOTA
to the user or role to limit query time, read rows, or errors per interval.