Changes a database user account.
Syntax
ALTER USER role_name IDENTIFIED BY password REPLACE prev_password
Description
If you are a role that does not have the CREATEROLE privilege, you can run the ALTER USER… IDENTIFIED BY command to change the password. If you use an unauthorized role and PASSWORD_VERIFY_FUNCTION is not NULL in the configuration file, you must include the REPLACE clause and the previous password. If a non-superuser uses the REPLACE clause, the server compares the provided password with the existing password. If the passwords do not match, an error occurs.
Parameters
Parameter | Description |
---|---|
role_name | The name of the role whose password is to be changed. |
password | The new password of the role. |
prev_password | The previous password of the role. |
Examples
Execute the following statement to change a user password:
ALTER USER john IDENTIFIED BY xyRP35z REPLACE 23PJ74a;