SET PASSWORD

2023-10-24 09:23:03  Updated

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 its 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('**1***');
    Query OK, 0 rows affected (0.02 sec)
    
  • Change the password of user sqluser01.

    obclient> SET PASSWORD FOR sqluser01 = PASSWORD('**2***');
    Query OK, 0 rows affected (0.02 sec)
    

Contact Us