Purpose
You can use this statement to create an OceanBase Database user. After you create a user, you can use it to connect to OceanBase Database.
Note
You must have the CREATE USER system privilege to use the CREATE USER statement.
Syntax
create_user_stmt:
CREATE USER user_name [host_name] IDENTIFIED BY password
[REQUIRE {NONE | SSL | X509 | tls_option_list}]
[PROFILE user_profile]
[DEFAULT TABLESPACE table_space]
[PRIMARY_ZONE 'zone_name']
password:
STR_VALUE
tls_option_list:
tls_option
| tls_option_list, tls_option
tls_option:
CIPHER STR_VALUE
| ISSUER STR_VALUE
| SUBJECT STR_VALUE
Parameters
| Parameter | Description | |
|---|---|---|
| user_name | The username. For each user created, a new entry is created in the dba_users table. If the username already exists, an error is returned. |
|
| host_name | The name of the host where the user is located, which is in the format of @xxx.xxx.xx.x. |
|
| IDENTIFIED BY | You must use the IDENTIFIED BY clause to specify a password for the user. If the password contains special characters |
, it must be enclosed in double quotation marks. Special characters are ~ ! @ # % ^ & * _ - + = ` ( ) { } link[1]link: ; ' , . ? /[] |
| REQUIRE | The encryption protocol for the user. Valid values: NONE, SSL, X509, and tls_option_list. |
|
| PROFILE user_profile | The profile used by the user. | |
| DEFAULT TABLESPACE table_space | The default tablespace for the user. | |
| PRIMARY_ZONE | The primary zone of the user. |
Examples
Create a user named
user1and set its password to **1***.obclient> CREATE USER user1 IDENTIFIED BY ******; Query OK, 0 rows affectedQuery the users that you created.
obclient> SELECT username FROM dba_users; +------------+ | USERNAME | +------------+ | SYS | | LBACSYS | | ORAAUDITOR | | PUBLIC | | YH0917 | | USER1 | +------------+ 6 rows in set