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, you must have the global CREATE USER privilege.
Syntax
Change the password of a user
ALTER USER 'username' IDENTIFIED BY 'password';Lock a user
ALTER USER user [lock_option]; lock_option: ACCOUNT LOCK | ACCOUNT UNLOCK
Parameters
| Parameter | Description |
|---|---|
| ACCOUNT LOCK | Locks the user. |
| ACCOUNT UNLOCK | Unlocks the user. |
Examples
Change the password of a user
Change the password of user
sqluser01toabc123.obclient> ALTER USER 'sqluser01' IDENTIFIED BY 'abc123';Lock a user
Lock user
obsqluser01.obclient> ALTER USER 'obsqluser01' ACCOUNT LOCK;Unlock a user
Unlock user
obsqluser01.obclient> ALTER USER 'obsqluser01' ACCOUNT UNLOCK;