- All users can reset their own password.
- Only users with the
user_adminrole can change the password of other users. - Only the
rootuser itself can change its password. For more information, see the priviege overview.
Syntax
user_identity must match exactly the user_identity specified when creating a user by using CREATE USER. Otherwise, the user will be reported as non-existent. If user_identity is not specified, the password of the current user will be changed. The current user can be viewed through SHOW GRANTS.
PASSWORD() inputs a plaintext password. If you directly input a string without using PASSWORD(), the string must be encrypted.
Examples
-
Set the password for the current user.
-
Set the password for a specified user.