Purpose
You can use this statement to change the password of the current user or other users.
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 its password. |
| user_name | The username. |
| password | The new password of the user. |
Examples
Change the password of user1 to **1***.
obclient> SET PASSWORD FOR user1 = PASSWORD(**1***);
Query OK, 0 rows affected