PolarDB for MySQL on ENS (edge clusters) lets you change account passwords, set password expiration policies, and control password strength validation—all from the console or command line.
Prerequisites
Before you begin, ensure that you have:
A PolarDB for MySQL edge cluster
A privileged account (required for command-line operations and password expiration settings)
Limitations
| Feature | MySQL 5.6 | MySQL 5.7 | MySQL 8.0 |
|---|---|---|---|
| Change password (console) | Supported | Supported | Supported |
| Change password (command line) | Supported | Supported | Supported |
| Set password expiration | Not supported | Supported | Supported |
validate_password plugin | Not supported | Supported | Supported |
Change account passwords
After you change an account password, the old password can no longer be used to access the cluster.
Console
Go to the PolarDB console for ENS. In the Cluster List, click the ID of the target cluster.
In the left navigation pane, choose Configuration and Management > Account Management.
Find the account and click Change Password in the Actions column.
In the Change Password dialog box, enter a new password in the New Password and Confirm New Password fields, then click OK.
Command line
Only a privileged account can change 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 can log in. Use % to allow login from any host |
password | The new 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 can log in. Use % to allow login from any host |
password | The new password for the account |
Set password expiration
Password expiration can only be configured from the command line using a privileged account. MySQL 5.6 does not support this feature.
Connect to the database using a privileged account. See Connect to a PolarDB for MySQL edge cluster.
Run the following SQL statement:
ALTER USER 'username'@'hostname' PASSWORD EXPIRE INTERVAL N DAY;Parameter Description usernameThe account to configure hostnameThe hostname for the account NThe password validity period in days
Enable or disable password validation
The validate_password plugin enforces password strength policies. Install it to enable validation, or uninstall it to disable validation. MySQL 5.6 does not support this feature.
validate_password parameters cannot be modified in the console. Use the command line to modify these parameters.Connect to the database using a privileged account. See Connect to a PolarDB for MySQL edge cluster.
Install
validate_passwordto enable password validation:MySQL 8.0
INSTALL COMPONENT 'file://component_validate_password';MySQL 5.7
INSTALL PLUGIN validate_password SONAME 'validate_password.so';(Optional) Uninstall
validate_passwordto disable password validation:MySQL 8.0
UNINSTALL COMPONENT 'file://component_validate_password';MySQL 5.7
UNINSTALL PLUGIN validate_password;