This topic describes how to create a standard account for a community-compatible ApsaraDB for ClickHouse cluster using SQL statements.
Prerequisites
You must use a privileged account.
Limits
A maximum of 500 standard accounts can be created for a cluster.
Syntax
CREATE USER [IF NOT EXISTS] name1 [, name2, ...] [ON CLUSTER default]
[NOT IDENTIFIED | IDENTIFIED {[WITH {auth_type}] BY {'password'}}]Parameters
ON CLUSTER default: Creates the account on each node. This parameter must be set toON CLUSTER default.NOT IDENTIFIED: Does not set a password for the account. UsingNOT IDENTIFIEDis equivalent to usingIDENTIFIED WITH no_password.IDENTIFIED BY 'password': Sets the password for the account. The password is encrypted using the SHA256 algorithm. UsingIDENTIFIED BY 'password'is equivalent to usingIDENTIFIED WITH sha256_password BY 'password'.auth_type: Specifies the storage method for the password.no_password: No password is set for the account. A password is not required to log on.plaintext_password: The password is stored in plain text.sha256_password: The password is stored with SHA256 encryption.
Example
Create an account named account1 with the password Account1. The password is stored in plain text.
CREATE USER IF NOT EXISTS 'account1' ON CLUSTER default IDENTIFIED WITH plaintext_password BY 'Account1';Create an account named account2 with the password Account2. The password is stored with SHA256 encryption.
Use the
IDENTIFIED BY 'password'parameter to create the account.CREATE USER IF NOT EXISTS 'account2' ON CLUSTER default IDENTIFIED BY 'Account2';Use the
IDENTIFIED WITH sha256_password BY 'password'parameter to create the account.CREATE USER IF NOT EXISTS 'account2' ON CLUSTER default IDENTIFIED WITH sha256_password BY 'Account2';
Create an account named account3 without a password.
Use the
NOT IDENTIFIEDparameter to create the account.CREATE USER IF NOT EXISTS 'account3' ON CLUSTER default NOT IDENTIFIED;Use the
IDENTIFIED WITH no_passwordparameter to create the account.CREATE USER IF NOT EXISTS 'account3' ON CLUSTER default IDENTIFIED WITH no_password;
Create two accounts, account4 and account5, with the password Account. The password is stored with SHA256 encryption.
CREATE USER IF NOT EXISTS 'account4', 'account5' ON CLUSTER default IDENTIFIED BY 'Account';