CREATE USER creates a new user account in a PolarDB for PostgreSQL (Compatible with Oracle) database cluster. When the statement runs, PolarDB automatically creates a schema with the same name as the user; that schema is owned by the new user.
Prerequisites
Only a privileged account can run CREATE USER. To create a privileged account, see Create an account.
Syntax
CREATE USER name [IDENTIFIED BY password]Parameters
| Parameter | Description |
|---|---|
name | The name of the user. Must start with a lowercase letter. Can contain lowercase letters, digits, and underscores (_). |
password | The password for the user. Must start with a lowercase letter. Can contain lowercase letters, digits, and underscores (_). |
Note Both
name and password must be 1–63 characters in length.Example
Create a user named user with the password password:
CREATE USER user IDENTIFIED BY password;The statement creates a standard account. For the permissions granted to standard accounts, see Account permissions.
See also
Create database accounts — manage privileged and standard accounts