User Management

You can use CREATE USER and ALTER USER to create and manage database users.

Creating a User

The CREATE USER statement is used to create a GaussDB (DWS) user. After creating a user, you can use the user to connect to the database.

Altering User Attributes

The ALTER USER statement is used to alter user attributes, such as changing user passwords or permissions.

Example:

Locking a User

The ACCOUNT LOCK | ACCOUNT UNLOCK parameter in the statement is used to lock or unlock a user. A locked user cannot log in to the system. If an account is stolen or illegally accessed, the administrator can manually lock the account. After the account is secured, the administrator can manually unlock the account.

Example:

Deleting a User

The DROP USER statement is used to delete one or more GaussDB(DWS) users. An administrator can delete an account that is no longer used. Deleted users cannot be restored.

Example: