All Products
Search
Document Center

SET PASSWORD

Last Updated: Jun 18, 2021

Description

You can execute the SET PASSWORD statement to change the password for the current user or another user.

Syntax

SET PASSWORD [FOR user] = password_option;

password_option: {
PASSWORD('authstring')
|'hashstring'
}

Parameters

Parameter

Description

FOR user

If you do not use the FOR user clause, the statement changes the password for the current user. After a user logs on to the ApsaraDB for OceanBase system, the user can change its own password.

If you use the FOR user clause, the statement changes the password for a specified user. To change the password for a specified user, ensure that you have the global permission to execute the CREATE USER statement.

Examples

Run the following command to change the password of the sqluser01 user to abc123:

oceanBase(admin@TEST)>set password for sqluser01 = password('abc123');
Query OK, 0 rows affected (0.02 sec)