Create and manage database users.
List all users:
GQLSHOW USERS
Result columns:
| Column | Description |
|---|---|
username | User name |
status | Always ACTIVE for users created through DCL. |
roles | List of role names assigned to the user |
created_at | Timestamp when the user was created |
Show a specific user:
GQLSHOW USER alice
To get information about the user authenticated for the current session, use the CURRENT_USER bare keyword. It returns a record with username, roles, and is_admin fields:
GQLRETURN CURRENT_USER
Access individual fields:
GQLRETURN CURRENT_USER.username, CURRENT_USER.is_admin
User names are unquoted identifiers, they must start with a letter or underscore, and may contain letters, digits, and underscores after the first character. Passwords are string literals (enclosed in single quotes, double quotes, or backticks) and must be 6 to 128 characters.
GQLCREATE USER alice PASSWORD 'secure_password_123'
The optional WITH keyword is also accepted:
GQLCREATE USER alice WITH PASSWORD 'secure_password_123'
Change a user's password:
GQLALTER USER alice SET PASSWORD 'new_password_456'
GQLDROP USER alice
Use IF EXISTS to avoid errors if the user does not exist:
GQLDROP USER IF EXISTS alice