All Products
Search
Document Center

PolarDB:Manage database account passwords

Last Updated:Mar 28, 2026

Use the PolarDB console or SQL statements to change account passwords, set password expiration policies, and control password strength validation.

Important

Always use the methods described in this topic to change account passwords or permissions. Running UPDATE or INSERT on the MySQL permission tables bypasses PolarDB's replication mechanism — changes will not be synchronized to read-only nodes.

Version compatibility

The following table summarizes version support for each feature:

FeaturePolarDB for MySQL 5.6PolarDB for MySQL 5.7PolarDB for MySQL 8.0
Change password (console)SupportedSupportedSupported
Change password (SQL)SupportedSupportedSupported
Password expirationNot supportedSupportedSupported
validate_password extensionNot supportedSupportedSupported

Account types

PolarDB for MySQL supports two account types.

Note

Root accounts cannot be created or used in PolarDB for MySQL.

Account typeDescription
Privileged accountOne privileged account per cluster. It can manage all standard accounts and databases, create databases and standard accounts, authorize standard accounts, and disconnect any standard account. Create and manage privileged accounts in the PolarDB console only.
Standard accountMultiple standard accounts per cluster (maximum depends on the database engine). Create and manage standard accounts in the console or with SQL statements. A standard account can only access databases it has been authorized for, and cannot create databases, other standard accounts, or disconnect other accounts.

Change a password in the console

  1. Log on to the PolarDB console.

  2. In the top navigation bar, select the region where your cluster is deployed.

  3. Find the cluster and click its ID.

  4. In the left-side navigation pane, choose Settings and Management > Accounts.

  5. Find the account and click Change Password in the Actions column.

  6. In the Change Password dialog box, enter and confirm the new password, then click OK.

Change a password with SQL statements

Connect to the cluster using the privileged account, then run the statement for your MySQL version.

PolarDB for MySQL 8.0

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

PolarDB for MySQL 5.6 or 5.7

SET PASSWORD FOR 'username'@'host' = PASSWORD('password');
ParameterDescription
usernameThe account whose password you want to change.
hostThe host from which the account can log on to the database. Set to % to allow login from all hosts.
passwordThe new password.

Set password expiration

Password expiration requires the privileged account. PolarDB for MySQL 5.6 does not support this feature.

  1. Connect to the cluster using the privileged account.

  2. Run the following statement:

    ALTER USER 'username'@'hostname' PASSWORD EXPIRE INTERVAL N DAY;
    ParameterDescription
    usernameThe account to configure.
    hostnameThe host from which the account can log on to the database.
    NThe number of days before the password expires.

Enable or disable password strength validation

The validate_password extension enforces password strength policies. Install or uninstall it using the privileged account. PolarDB for MySQL 5.6 does not support this extension.

  1. Connect to the cluster using the privileged account.

  2. Run the statement for your MySQL version:

    PolarDB for MySQL 8.0

    • Install:

      INSTALL COMPONENT 'file://component_validate_password';
    • Uninstall:

      UNINSTALL COMPONENT 'file://component_validate_password';

    PolarDB for MySQL 5.7

    • Install:

      INSTALL PLUGIN validate_password SONAME 'validate_password.so';
    • Uninstall:

      UNINSTALL PLUGIN validate_password;

Modify validate_password parameters

The validate_password parameters cannot be modified in the PolarDB console. To modify these parameters, join DingTalk group 35365027095 to get technical support. A PolarDB chatbot assistant is also available 24/7 in the group.