Purpose
You can use this statement to perform the following operations:
Change the password of an OceanBase Database user.
Lock or unlock a user. A locked user cannot log on to OceanBase Database.
Note
To execute this statement to perform an operation other than changing the password of the current user, you must have the
CREATE USERprivilege.
Syntax
Change the password of a user
ALTER USER 'user_name' IDENTIFIED BY 'password';Lock or unlock a user
ALTER USER 'user_name' [ACCOUNT LOCK | ACCOUNT UNLOCK];
Parameters
| Parameter | Description |
|---|---|
| user_name | The name of the user. |
| password | The new password. |
| ACCOUNT LOCK | Locks the user. |
| ACCOUNT UNLOCK | Unlocks the user. |
Examples
Change the password of user
sqluser01to**1***.obclient> ALTER USER 'sqluser01' IDENTIFIED BY '**1***';Lock user
obsqluser01.obclient> ALTER USER 'obsqluser01' ACCOUNT LOCK;Unlock user
obsqluser01.obclient> ALTER USER 'obsqluser01' ACCOUNT UNLOCK;