You can use the CREATE USER syntax to create a new user in a Lindorm instance. You can use the SHOW USERS syntax to check all existing users of the current instance before you create a user to avoid user name conflicts.
Applicable engines and versions
The CREATE USER syntax is applicable to all versions of LindormTable and LindormTSDB.
Syntax
create_user_statement ::= CREATE USER [IF NOT EXISTS] user_identifier identified BY 'password';
password ::= string
Parameters
User name (user_identifier)
The user name must meet the following requirements:
The name can be 4 to 15 characters in length.
The name can contain digits, letters, hyphens (-), and underscores (_).
The following reserved words cannot be used as user names: system, anonymous, and lindorm.
If the name of the user that you want to create already exists and the IF NOT EXISTS
conditions is not specified in the CREATE USER
statement, an error is returned to indicate that the user already exists. If you specify the IF NOT EXISTS
condition in the CREATE USER
statement, the user is not created and no error is returned.
Password (password)
The data type of the specified password must be VARCHAR.
Examples
Create a user named test_user
and set the password of the user to testuserpassword
.
CREATE USER IF NOT EXISTS test_user identified BY 'testuserpassword';