CREATE USER
The CREATE USER statement creates a new user in Redpanda SQL. CREATE ROLE is a synonym for CREATE USER, provided for PostgreSQL compatibility. Only a superuser can run this statement.
A password is required when creating a user.
|
Error messages from the SQL engine refer to users as "roles" (for example, |
|
On Redpanda Cloud BYOC, users are provisioned automatically when a Redpanda Cloud user or service account is assigned a role with the SQL: Access or SQL: Manage permission. |
Syntax
CREATE { USER | ROLE } user_name [WITH] PASSWORD 'password' [SUPERUSER | NOSUPERUSER];
-
user_name: Name of the new user. Cannot beCURRENT_USERorCURRENT_ROLE. -
PASSWORD 'password': Required. The password must be a non-empty string literal. -
SUPERUSER: Optional. Grants superuser privileges to the new user. Superusers bypass authorization checks. -
NOSUPERUSER: Optional. Explicitly marks the user as a non-superuser. Default when neitherSUPERUSERnorNOSUPERUSERis specified. -
WITH: Optional. Has no effect; provided for PostgreSQL compatibility.
Examples
Create a regular user with a password:
CREATE USER "alice@example.com" WITH PASSWORD 'secret123';
Create a superuser:
CREATE USER "admin@example.com" WITH PASSWORD 'admin_secret' SUPERUSER;