Creates a new user in a Lindorm instance. Run SHOW USERS to list existing users before creating a new one to avoid username conflicts.
Applicable engines and versions
| Engine | Versions |
|---|---|
| LindormTable | All versions |
| LindormTSDB | All versions |
Syntax
CREATE USER [IF NOT EXISTS] user_identifier identified BY 'password';Parameters
| Parameter | Description |
|---|---|
IF NOT EXISTS | Optional. If the username already exists and IF NOT EXISTS is omitted, an error is returned. If IF NOT EXISTS is specified and the username already exists, the statement is a no-op — no user is created and no error is returned. |
user_identifier | The username. Requirements: 4–15 characters; may contain letters, digits, hyphens (-), and underscores (_); cannot be a reserved word (system, anonymous, lindorm). |
password | The user's password. Must be of type VARCHAR. |
Example
Create a user named test_user with password testuserpassword. If the user already exists, the statement does nothing.
CREATE USER IF NOT EXISTS test_user identified BY 'testuserpassword';See also
SHOW USERS: List all users in the current instance
ALTER USER: Change a user's password
DROP USER: Delete a user
GRANT: Grant privileges to a user