CREATE USER creates a user.
1 | CREATE USER user_name [ [ WITH ] option [ ... ] ] [ ENCRYPTED | UNENCRYPTED ] { PASSWORD | IDENTIFIED BY } { 'password' | DISABLE }; |
The option clause is used for setting information including permissions and attributes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | {SYSADMIN | NOSYSADMIN} | {AUDITADMIN | NOAUDITADMIN} | {CREATEDB | NOCREATEDB} | {USEFT | NOUSEFT} | {CREATEROLE | NOCREATEROLE} | {INHERIT | NOINHERIT} | {LOGIN | NOLOGIN} | {REPLICATION | NOREPLICATION} | {INDEPENDENT | NOINDEPENDENT} | {VCADMIN | NOVCADMIN} | CONNECTION LIMIT connlimit | VALID BEGIN 'timestamp' | VALID UNTIL 'timestamp' | RESOURCE POOL 'respool' | USER GROUP 'groupuser' | PERM SPACE 'spacelimit' | TEMP SPACE 'tmpspacelimit' | SPILL SPACE 'spillspacelimit' | NODE GROUP logic_cluster_name | IN ROLE role_name [, ...] | IN GROUP role_name [, ...] | ROLE role_name [, ...] | ADMIN role_name [, ...] | USER role_name [, ...] | SYSID uid | DEFAULT TABLESPACE tablespace_name | PROFILE DEFAULT | PROFILE profile_name | PGUSER | AUTHINFO 'authinfo' | PASSWORD EXPIRATOIN period |
Specifies the user name.
Value range: a string. It must comply with the naming convention. A value can contain a maximum of 63 characters.
Specifies the login password.
A password must:
Value range: a string
For details on other parameters, see CREATE ROLE Parameter Description.
Create user jim.
1 | CREATE USER jim PASSWORD '{password}'; |
The following statements are equivalent to the above.
1 | CREATE USER kim IDENTIFIED BY '{password}'; |
For a user having the Create Database permission, add the CREATEDB keyword.
1 | CREATE USER dim CREATEDB PASSWORD '{password}'; |