Purpose
You can use this statement to change the password of a user that has logged on to OceanBase Database or another user.
Syntax
SET PASSWORD [FOR user] = password_option;
password_option: {
PASSWORD('authstring')
|'hashstring'
}
Parameters
| Parameter | Description |
|---|---|
| FOR user | If the FOR user clause is absent, this statement changes the password of the current user. Any logged-on user can change their password. If the FOR user clause is present, this statement changes the password of the specified user. To change the password of the specified user, you must have the global CREATE USER privilege (MySQL mode). |
Examples
Change the password of the current user.
obclient> SET PASSWORD = PASSWORD('******'); Query OK, 0 rows affectedChange the password of user
sqluser01.obclient> SET PASSWORD FOR sqluser01 = PASSWORD('**2***'); Query OK, 0 rows affected