Creates a standard account for a community-compatible ApsaraDB for ClickHouse cluster.
Prerequisites
Before you begin, ensure that you have:
A privileged account to run this statement
Fewer than 500 standard accounts in the cluster (maximum limit)
Syntax
CREATE USER [IF NOT EXISTS] name1 [, name2, ...] [ON CLUSTER default]
[NOT IDENTIFIED | IDENTIFIED {[WITH {auth_type}] BY {'password'}}]Parameters
| Parameter | Description |
|---|---|
ON CLUSTER default | Applies the account to all nodes in the cluster. Must be set to ON CLUSTER default. |
NOT IDENTIFIED | Creates the account with no password. Equivalent to IDENTIFIED WITH no_password. |
IDENTIFIED BY 'password' | Creates the account with a password encrypted using the SHA256 algorithm. Equivalent to IDENTIFIED WITH sha256_password BY 'password'. |
auth_type | Specifies the storage method for the password. Supported values: |
Supported `auth_type` values:
| Value | Description |
|---|---|
no_password | No password is set. Users can log on without a password. |
plaintext_password | Password is stored in plain text. |
sha256_password | Password is stored with SHA256 encryption. |
Examples
Create an account with SHA256 encryption (recommended)
Both statements create account2 with the password Account2 stored using SHA256 encryption:
-- Shorthand form
CREATE USER IF NOT EXISTS 'account2' ON CLUSTER default IDENTIFIED BY 'Account2';
-- Explicit form
CREATE USER IF NOT EXISTS 'account2' ON CLUSTER default IDENTIFIED WITH sha256_password BY 'Account2';Create an account with a plain text password
CREATE USER IF NOT EXISTS 'account1' ON CLUSTER default IDENTIFIED WITH plaintext_password BY 'Account1';Create an account without a password
Both statements create account3 with no password:
-- Shorthand form
CREATE USER IF NOT EXISTS 'account3' ON CLUSTER default NOT IDENTIFIED;
-- Explicit form
CREATE USER IF NOT EXISTS 'account3' ON CLUSTER default IDENTIFIED WITH no_password;Create multiple accounts in one statement
The following statement creates account4 and account5 with the password Account stored using SHA256 encryption:
CREATE USER IF NOT EXISTS 'account4', 'account5' ON CLUSTER default IDENTIFIED BY 'Account';