Overview
A database user has access to the database system and can perform various querying or administering operations based on their assigned privileges.
Showing Users
To list all database users:
SHOW USER
It returns a table _user
with the following fields:
Field |
Description |
---|---|
username |
Name of the user. |
create |
The date and time when the user was created. |
graphPrivileges |
Graph privileges granted to the user. |
systemPrivileges |
System privileges granted to the user. |
propertyPrivileges |
Property privileges granted to the user. |
policies |
Policies granted to the user. |
Creating a User
The CREATE USER
statement creates a database user.
To create user johndoe
with a password:
CREATE USER johndoe WITH PASSWORD 'mHMUUjQWG46z'
Details
- The username must be unique. Naming conventions are:
- 2 to 64 characters.
- Begins with a letter.
- Allowed characters: letters (A-Z, a-z), numbers (0-9) and underscores (
_
).
- The password of the user must be between 6 to 64 characters in length.
Altering a User
You can alter the username and password of a user using the ALTER USER
statement.
To rename user johndoe
to johndoe_1
:
ALTER USER johndoe RENAME TO johndoe_1
To update the password for user admin
:
ALTER USER admin SET PASSWORD 'zdcsQ7QFaCCE'
Dropping a User
You can drop a user using the DROP USER
statement.
To drop the user johndoe
:
DROP USER johndoe