Skip to main content

ALTER USER

Modifies the properties for an existing user.

Syntax

ALTER USER <name> IDENTIFIED [WITH auth_type ] BY 'auth_string'

Where:

auth_type: {
double_sha1_password
| sha256_password
| no_password
}

auth_type default is double_sha1_password.

Examples

CREATE USER user1 IDENTIFIED BY 'abc123';
SHOW USERS;
+-----------+----------+----------------------+------------------------------------------+---------------+
| name | hostname | auth_type | auth_string | is_configured |
+-----------+----------+----------------------+------------------------------------------+---------------+
| user1 | % | double_sha1_password | 6691484ea6b50ddde1926a220da01fa9e575c18a | NO |
+-----------+----------+----------------------+------------------------------------------+---------------+
ALTER USER user1 IDENTIFIED WITH sha256_password BY '123abc';
SHOW USERS;
+-------+----------+-----------------+------------------------------------------------------------------+---------------+
| name | hostname | auth_type | auth_string | is_configured |
+-------+----------+-----------------+------------------------------------------------------------------+---------------+
| user1 | % | sha256_password | dd130a849d7b29e5541b05d2f7f86a4acd4f1ec598c1c9438783f56bc4f0ff80 | NO |
+-------+----------+-----------------+------------------------------------------------------------------+---------------+
ALTER USER 'user1' IDENTIFIED WITH no_password;
show users;
+-------+----------+-------------+-------------+---------------+
| name | hostname | auth_type | auth_string | is_configured |
+-------+----------+-------------+-------------+---------------+
| user1 | % | no_password | | NO |
+-------+----------+-------------+-------------+---------------+