After a user is created, the administrator or the user can change the password of the user.
Change the password of a user by using the ALTER USER statement
You can execute the ALTER USER statement to change the passwords of other users. To execute this statement, you must have the UPDATE USER privilege.
For information about how to view your privileges, see View user privileges. If you do not have the required privileges, contact the administrator to obtain the privileges. For more information, see Modify user privileges.
Syntax:
ALTER USER username IDENTIFIED BY password;
Example: Change the password of sqluser01 to ******.
obclient> ALTER USER sqluser01 IDENTIFIED BY ******;
For more information about the ALTER USER statement, see ALTER USER.
Change the password of a user by using the SET PASSWORD statement
You can execute the SET PASSWORD statement to change your password or the passwords of other users.
Syntax:
SET PASSWORD [FOR user] = PASSWORD(password);
Notes:
If the
FOR userclause is not specified, this statement changes the password of the current user. Any logged-on user can change their password.If the
FOR userclause is specified, this statement changes the password of the specified user. To change the password of the specified user, you must have theCREATE USERprivilege.For information about how to view your privileges, see View user privileges. If you do not have the required privileges, contact the administrator to obtain the privileges. For more information, see Modify user privileges.
Example: Change the password of sqluser01 to ******.
obclient> SET PASSWORD for sqluser01 = PASSWORD(******);
Query OK, 0 rows affected
For more information about the SET PASSWORD statement, see SET PASSWORD.