Back to Starrocks

CREATE ROLE

docs/en/sql-reference/sql-statements/account-management/CREATE_ROLE.md

4.1.01.2 KB
Original Source

CREATE ROLE

import UserManagementPriv from '../../../_assets/commonMarkdown/userManagementPriv.mdx'

CREATE ROLE creates a role. After a role is created, you can grant privileges to the role and then assign this role to a user or another role. This way, the privileges associated with this role are passed on to users or roles.

<UserManagementPriv />

Syntax

sql
CREATE ROLE <role_name>

Parameters

role_name: the name of the role. For the naming conventions, see System limits.

Note that the created role name cannot be the same as system-defined roles: root, cluster_admin, db_admin, user_admin, and public.

Limits

By default, a user can have a maximum of 64 roles. You can adjust this setting by using the FE dynamic parameter privilege_max_total_roles_per_user. A role can have a maximum of 16 inheritance levels. You can adjust this setting by using the FE dynamic parameter privilege_max_role_depth.

Examples

Create a role.

sql
CREATE ROLE role1;

References