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

Configuring a Password Expiration Policy

Scenarios

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.

You can configure a password expiration policy for your instance in either of the following ways:

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 and select a region.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the instance name.
  5. In the navigation pane, choose Parameters.
  6. 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.

  7. 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.
  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 DB instance on the Instances page. On the displayed Overview page, click Log In in the upper right corner.

  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.