This topic describes how to reset the password for an ApsaraDB for MongoDB instance. If you forget your password or did not set the password when you created an instance, you can reset the password of the instance.

Limits

You can only reset the password of the root user or an account for a shard or config server.

Note If you want to manage database users created by running the db.createUser command, you can use DMS or the mongo shell. For more information, see Manage MongoDB users though DMS or Log on to the MongoDB instance through the mongo shell.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the region where the target ApsaraDB for MongoDB subscription instance resides.
  3. In the left-side navigation pane, click Replica Set Instances or Sharding Instances.
  4. Find the target instance and click its instance ID.
  5. In the left-side navigation pane, click Accounts.
  6. Perform one of the following operations as needed.
    • Reset the password of the root user.
      Find the root user and click Reset Password in the Operation column.
    • Reset the password of an account for a shard or config server in a sharded cluster instance.
      Note If no endpoints are obtained for the shard or config server, this operation cannot be performed. For more information about how to obtain the endpoints, see Apply for a connection string of a shard or Configserver node.
      Find the account created when you apply for an endpoint for a shard or config server, and click Reset Password in the Operation column. For this example, find shardaccount. For more information, see Apply for a connection string of a shard or Configserver node.
  7. In the dialog box that appears, enter a new password and confirm it.
    Note
    • The password must be 8 to 32 characters in length.
    • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include ! # $ % ^ & * ( ) _ + - =
  8. Click OK.