# Setting Account Password

__*zz-BGL*__
__*zz-Jeff*__

__*TiDB account password settings*__

+ **Example 1:** An initial password can be specified for the user by including an **`IDENTIFIED BY`** clause in the **`CREATE USER`** statement
+ **Example 2:** Use the **`SET PASSWORD`** statement to modify the password
+ **Example 3:** Use the **`ALTER USER`** statement to modify it

```8
~!@// Example 1@!~
CREATE USER 'test'@'localhost' IDENTIFIED BY 'guessit';

~!@// Example 2@!~
SET PASSWORD FOR 'test'@'localhost' = PASSWORD('guessit');

~!@// Example 3@!~
ALTER USER 'test'@'localhost' IDENTIFIED BY 'guessit';
```

-------------------------------------------------------------
`TiDB` stores the password in the `mysql.user` system table. Only users with `CREATE USER` privilege or `mysql` database privilege (`INSERT` privilege for create and `UPDATE` privilege for update) can set or modify passwords.

Specify the password with `IDENTIFIED BY` when creating a user in `CREATE USER`:

Modify the password for an existing account can be done with the `SET PASSWORD FOR` or `ALTER USER` statements:

The most common way to change an existing account's password (without changing any of its privileges), is to use the `SET PASSWORD` statement.
