| title | User Commands |
|---|---|
| description | Use these commands to manage the SQLite Cloud users. |
| category | reference |
| status | publish |
| slug | user-commands |
The CREATE USER command adds a new user username with a specified password to the server. During user creation, you can also pass a comma-separated list of roles to apply to that user. The DATABASE and TABLE optional arguments can restrict the particular ROLE to a specific resource. If ROLE is omitted then DATABASE and TABLE parameters are ignored.
CREATE USER username PASSWORD password [ROLE role_name [DATABASE database_name] [TABLE table_name]]
USERADMIN
OK string or error value (see SCSP protocol).
> CREATE USER user1 PASSWORD gdfhjs76fdgshj
OKThe DISABLE USER command disables a specified username from the system (it does not remove it). After command execution, the user specified in the username argument can no longer log into the system.
DISABLE USER username
USERADMIN
OK string or error value (see SCSP protocol).
> DISABLE USER user1
OKThe ENABLE USER command re-enables a previously disabled user from the system. Once re-enabled, that username can log in again.
ENABLE USER username
USERADMIN
OK string or error value (see SCSP protocol).
> ENABLE USER user1
OKThe GET USER command returns the username of the currency-connected user.
GET USER
NONE
A String set to the current username.
> GET USER
adminThe LIST USERS command retrieves a list of all users created on the server. The WITH ROLES argument also adds a column with a list of roles associated with each username. To restrict the list to all the users that get access to a specific database and/or table you can use the DATABASE and/or TABLE arguments.
LIST USERS [WITH ROLES] [DATABASE database_name] [TABLE table_name]
USERADMIN
A Rowset with the following columns:
- username: user name
- enabled: 1 enabled, 0 disabled
- roles: list of roles
- databasename: database name
- tablename: table name
The ** roles**, ** databasename** and ** tablename** columns are returned only when the WITH ROLES flag is used.
> LIST USERS
----------|---------|
username | enabled |
----------|---------|
admin | 1 |
----------|---------|
> LIST USERS WITH ROLES
----------|---------|-------|--------------|-----------|
username | enabled | roles | databasename | tablename |
----------|---------|-------|--------------|-----------|
admin | 1 | ADMIN | * | * |
----------|---------|-------|--------------|-----------|The REMOVE USER command removes the user specified in the username parameter from the system. After command execution, the username cannot log in to the server. Admin users cannot be removed from the system.
REMOVE USER username
USERADMIN
OK string or error value (see SCSP protocol).
> REMOVE USER user1
OKThe RENAME USER command updates an existing username to a new one.
RENAME USER username TO new_username
USERADMIN
OK string or error value (see SCSP protocol).
> RENAME USER user1 TO user2
OKThe SET MY PASSWORD command changes the password for the currently connected user.
SET MY PASSWORD password
NONE
OK string or error value (see SCSP protocol).
> SET MY PASSWORD foo
OKThe SET PASSWORD command sets or changes the password for an existing username.
SET PASSWORD password USER username
USERADMIN
OK string or error value (see SCSP protocol).
> SET PASSWORD uweri76878dsa USER user1
OK