> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# SET PASSWORD

> SET PASSWORD changes the login password for users.

SET PASSWORD changes the login password for users. The [ALTER USER](/documents/4.2/sql-reference/sql-statements/account-management/ALTER_USER.md) command can also be used to change a password.

**Tip**

* All users can reset their own password.
* Only users with the `user_admin` role can change the password of other users.
* Only the `root` user itself can change its password. For more information, see [the priviege overview](/documents/4.2/administration/user_privs/authorization/user_privs.md).

### Syntax

```SQL theme={null}
SET PASSWORD [FOR user_identity] =
[PASSWORD('plain password')]|['hashed password']
```

The `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](/documents/4.2/sql-reference/sql-statements/account-management/SHOW_GRANTS.md).

`PASSWORD()` inputs a plaintext password. If you directly input a string without using `PASSWORD()`, the string must be encrypted.

## Examples

1. Set the password for the current user.

   ```SQL theme={null}
   SET PASSWORD = PASSWORD('123456')
   SET PASSWORD = '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9'
   ```

2. Set the password for a specified user.

   ```SQL theme={null}
   SET PASSWORD FOR 'jack'@'192.%' = PASSWORD('123456')
   SET PASSWORD FOR 'jack'@['domain'] = '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9'
   ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.