Description
You can execute the ALTER USER statement to perform the following operations:
Change the password of a user that is used to log on to the ApsaraDB for OceanBase system.
Lock or unlock a user. A locked user cannot log on to the ApsaraDB for OceanBase system.
Note
To execute the ALTER USER statement, ensure you have the global UPDATE USER permission.
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 UNLOCK | Lock the user. |
| ACCOUNT UNLOCK | Unlock the user. |
Examples
- Change a password.
Execute the following statement to change the password of the sqluser01 user to abc123:
ALTER USER 'sqluser01' IDENTIFIED BY 'abc123';
- Lock a user.
Lock the obsqluser01 user.
ALTER USER 'obsqluser01' ACCOUNT LOCK;
- Unlock a user.
Unlock the obsqluser01 user.
ALTER USER 'obsqluser01' ACCOUNT UNLOCK;