Purpose
You can use this statement to change the password of a user that has logged on to OceanBase Database or another user.
For more information about other password changing methods, see ALTER USER.
Syntax
SET PASSWORD [FOR user_name] = PASSWORD(password);
password:
STR_VALUE
Parameters
| Parameter | Description |
|---|---|
| FOR | Indicates changing the password of a specified user. This clause is optional. To change the password of a specified user, you must have the ALTER USER privilege. If the FOR clause is omitted, the password of the current user is changed. Any logged-on user can change their password. |
| user_name | The name of the user. |
| password | The new password of the user. |
Examples
Change the password of user1 to ******.
obclient> SET PASSWORD FOR user1 = PASSWORD(******);
Query OK, 0 rows affected