SET PASSWORD

NOTE

Currently, resetting user passwords using SQL commands is not supported.

Description

Resets the password of a user. Users can reset their own passwords without need any privileges. Only the user_admin role can reset passwords for other users.

Syntax

SET PASSWORD [FOR <username>] =
[PASSWORD('plain password')] | ['hashed password']

Parameters

username: the username for which you reset the password.

PASSWORD() inputs plaintext passwords, while the direct usage of strings requires the transmission of encrypted password.

Examples

  1. Modify the password of the current user

    SET PASSWORD = PASSWORD('123456')
    SET PASSWORD = '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9'
  2. Modify the password of the specified user

    SET PASSWORD FOR 'jack'@'192.%' = PASSWORD('123456')
    SET PASSWORD FOR 'jack'@['domain'] = '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9'