You can centrally manage users, roles, and permissions on each ClickHouse node in a cluster. You can control user permissions by creating roles, creating users, and binding roles to users on the console.
Parameter | Description |
|---|---|
Rolename | The role name must start with a letter and can contain 1 to 64 characters. |
Global Permission | Global permissions refer to the permissions on all databases and tables, including the SELECT, LOAD, ALTER, CREATE, and DROP permissions. |
Each Level Permission | Database And Table refers to the databases and tables created in the cluster.
|
Parameter | Description |
|---|---|
Username | The new username must start with a letter and contain 1 to 64 characters. |
Password | Enter a password for the user. NOTE: The password must meet the following requirements:
|
Confirm Password | Enter the password again. |
For example, role A has the permission to query, insert, modify, create, and delete data. After being bound to role A, the user has the permissions of role A.
For details about how to connect to a non-security cluster, see Using a Client to Connect to a ClickHouse Normal Cluster.
./clickhouse client --host Internal IP address of the cluster --port 9000 --user admin --password Password
For details about how to connect to a security cluster, see Using the ClickHouse Client to Connect to a Cluster.
./clickhouse client --host Internal IP address of the cluster --port 9440 --user admin --password Password --secure --config-file /root/config.xml
CREATE role IF NOT EXISTS 'role_name' ON CLUSTER default_cluster;
GRANT CREATE ON *.* TO role1 ON CLUSTER default_cluster;
GRANT CREATE TABLE ON test_db.* TO role1;
GRANT DROP ON test_db.* TO role1;
DROP ROLE 'role_name' ON CLUSTER default_cluster;
CREATE USER IF NOT EXISTS name ON CLUSTER default_cluster IDENTIFIED WITH sha256_password BY 'password';
CREATE USER name HOST IP '127.0.0.x' IDENTIFIED WITH sha256_password BY 'password';
ALTER USER IF EXISTS name ON CLUSTER default_cluster IDENTIFIED WITH sha256_password BY 'password';
GRANT role1, role2 TO new_user ON CLUSTER default_cluster;
REVOKE role1 FROM user ON CLUSTER default_cluster;
DROP USER IF EXISTS 'name1' ON CLUSTER default_cluster;
show grants for all;
show grants for role1;