Using Role Management Commands
This section describes how to use basic syntax and SQL statements to manage roles.
- Creating a role ( role_name indicates the name of the role to be created)CREATE role IF NOT EXISTS 'role_name' ON CLUSTER default_cluster;
- Granting permissions to a role
- Granting all creation (database and table) permissionsGRANT CREATE ON *.* TO role1 ON CLUSTER default_cluster;
- Granting the permission to create tables in the test_db databaseGRANT CREATE TABLE ON test_db.* TO role1;
- Granting the permission to delete all databases and tablesGRANT DROP ON test_db.* TO role1;
- Granting all creation (database and table) permissions
- Deleting a roleDROP ROLE 'role_name' ON CLUSTER default_cluster;
- Querying the permissions and roles of a user
- Querying permissions of a usershow grants for all;
- Querying permissions of a roleshow grants for role1;
- Querying permissions of a user
Parent topic: ClickHouse Role Management