Updated on 2024-10-14 GMT+08:00

Configuring a Password Expiration Policy

Using the same password too long makes it easier for hackers to crack or guess your password. Requiring password changes after a certain amount of time can improve security. This section describes how to configure a password expiration policy.

Precautions

  • Once your password expires, you cannot log in to the database.
  • After the password expiration policy is configured, you need to periodically check whether your password is about to expire.

Modifying the Database Parameter

  1. Log in to the management console.
  2. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  3. On the Instances page, click the instance name.
  4. In the navigation pane, choose Parameters.
  5. On the displayed page, change the value of default_password_lifetime.

    The value of this parameter indicates how many days until a password expires. The default value is 0, indicating that the created user password will never expire.

  6. Click Save. In the displayed dialog box, click Yes.

Configuring the Password Expiration Policy Through DAS

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, locate the DB instance and click Log In in the Operation column.

    Alternatively, click the target DB instance on the Instances page. On the displayed Basic Information page, click Log In in the upper right corner of the page.

  5. Enter the username and password and click Log In.
  6. Choose SQL Operations > SQL Query.
  7. In the editing area, compile the statement shown below. The unit of password_life_time is day. You are advised to set it to 180.

    ALTER USER username PASSWORD EXPIRE INTERVAL password_life_time DAY;

  8. Click Execute SQL. Then, view SQL execution status on the Executed SQL Statements, Messages, and Result tab pages.