UltipaDocs
Products
Solutions
Resources
Company
Start Free Trial
UltipaDocs
Start Free Trial
  • Overview
  • User Management
  • Role Management
  • Grant & Revoke Permissions
  • Best Practices
  1. Docs
  2. /
  3. Access Control

User Management

Overview

Create and manage database users.

Showing Users

List all users:

GQL
SHOW USERS

Result columns:

ColumnDescription
usernameUser name
statusAlways ACTIVE for users created through DCL.
rolesList of role names assigned to the user
created_atTimestamp when the user was created

Show a specific user:

GQL
SHOW USER alice

Identifying the Current User

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:

GQL
RETURN CURRENT_USER

Access individual fields:

GQL
RETURN CURRENT_USER.username, CURRENT_USER.is_admin

Creating Users

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.

GQL
CREATE USER alice PASSWORD 'secure_password_123'

The optional WITH keyword is also accepted:

GQL
CREATE USER alice WITH PASSWORD 'secure_password_123'

Altering Users

Change a user's password:

GQL
ALTER USER alice SET PASSWORD 'new_password_456'

Dropping Users

GQL
DROP USER alice

Use IF EXISTS to avoid errors if the user does not exist:

GQL
DROP USER IF EXISTS alice