All Products
Search
Document Center

PolarDB:Manage account passwords

Last Updated:Oct 21, 2025

You can manage account passwords for PolarDB for MySQL edge clusters in the console or using SQL commands.

Change account passwords

Warning

After you change an account password, the old password can no longer be used to access the cluster. Perform this operation with caution.

You can change account passwords in the console or using SQL commands.

Console

  1. Go to the PolarDB console for ENS. In the Cluster List, click the ID of the target cluster to go to its product page.

  2. In the navigation pane on the left of the product page, choose Configuration and Management > Account Management.

  3. Find the destination account and click Change Password in the Actions column.

  4. In the Change Password dialog box, enter a new password in the New Password and Confirm New Password fields. Then, click OK.

Command line

In a PolarDB cluster, only a privileged account can change account passwords from the command line.

MySQL 8.0

ALTER USER 'username'@'host' IDENTIFIED BY '{password}'

Parameter

Description

username

The account whose password you want to change.

host

The host from which the account is allowed to log on. If the account can log on from any host, use a percent sign (%).

password

The password for the account.

MySQL 5.6 and MySQL 5.7

SET PASSWORD FOR 'username'@'host' = PASSWORD('password')

Parameter

Description

username

The account whose password you want to change.

host

The host from which the account is allowed to log on. If the account can log on from any host, use a percent sign (%).

password

The password for the account.

Configure the account password expiration time

For PolarDB clusters, you can set the account password expiration time only from the command line using a privileged account.

Note

MySQL 5.6 does not support setting the account password expiration time.

  1. Use a privileged account to connect to the database.

  2. Run the following SQL statement to set the account password expiration time.

    ALTER USER 'username'@'hostname' PASSWORD EXPIRE INTERVAL N DAY;

    In this statement, username is the name of the destination account, hostname is the hostname for the account, and N is the password validity period in days.

Enable or disable the password validation feature

You can enable or disable the password validation feature for a PolarDB cluster by installing or uninstalling the validate_password plug-in. The procedure is as follows:

Note
  • The validate_password plug-in is not supported on MySQL 5.6.

  • You cannot modify parameters related to validate_password in the console. You must use the command line to modify these parameters.

  1. Use a privileged account to connect to the database.

  2. Install validate_password to enable the password validation feature.

    MySQL 8.0

    INSTALL COMPONENT 'file://component_validate_password';

    MySQL 5.7

    INSTALL PLUGIN validate_password SONAME 'validate_password.so';
  3. (Optional) Uninstall validate_password to disable the password validation feature.

    MySQL 8.0

    UNINSTALL COMPONENT 'file://component_validate_password';

    MySQL 5.7

    UNINSTALL PLUGIN validate_password;