Updated on 2026-05-14 GMT+08:00

Changing a Database Port

Scenarios

You can change the database port of a primary instance or read replica. If you change the database port of a primary instance, that of the standby instance will automatically change as well.

If specific security group rules have been configured for a DB instance, you need to change the inbound rules of the security group to which the DB instance belongs after changing the database port.

Constraints

After read/write splitting is enabled, the database ports of primary DB instances and read replicas cannot be changed.

Changing the database port of a DB instance will cause the instance to reboot.

When the database port of a DB instance is being changed, you cannot:

  • Bind an EIP to the DB instance.
  • Delete the DB instance.
  • Create a backup for the DB instance.

Procedure

  1. Log in to the RDS console.
  2. Click in the upper left corner and select a region.
  3. On the Instances page, click the target DB instance or click first and then click the target read replica.
  4. On the Summary page, find Database Port and click Configure.

    Alternatively, choose Connectivity & Security in the navigation pane on the left. On the displayed page, click Change next to the Database Port field.

    RDS for MySQL instances can use database ports 1024 to 65535, excluding 12017, 33071, and 33062, which are reserved for RDS system use.

    • In the displayed dialog box, enter a new port and click Yes.

      If you have enabled operation protection, click Send Code in the displayed Identity Verification dialog box and enter the obtained verification code. Then, click OK.

      Two-factor authentication improves the security of your account and cloud product. For details about how to enable operation protection, see Identity and Access Management User Guide.

      • If you change the database port of the primary DB instance, that of the standby DB instance will also be changed and both DB instances will be rebooted.
      • If you change the database port of a read replica, the change will not affect other DB instances. Only the read replica will reboot.
      • This process takes about 1–5 minutes.
    • In the displayed dialog box, click No to cancel the modification.

  5. Check the results on the Summary page.

FAQ

  • Question 1: Do I Need to Change the Connection Port for My Application After Changing the Database Port of My DB Instance?

    Changing the port will interrupt database connections. To reconnect your application to the DB instance, you need to change the connection port for the application.

  • Question 2: Will My DB Instance Be Rebooted After I Change Its Port?

    Changing the database port of a DB instance will cause the instance to reboot.

  • Question 3: Does the Port of a DB Instance Change After a Primary/Standby Switchover?

    A primary/standby switchover does not change the connection information of an instance, including the VPC, subnet, security group, floating IP address, private domain name, and database port.