All Products
Search
Document Center

ApsaraDB RDS:Step 2: Connect to an ApsaraDB RDS for MySQL instance

Last Updated:Mar 28, 2026

After creating an RDS instance and a database, connect to the instance to manage data or link your application server to the database. This topic covers three connection methods: Data Management (DMS), the command-line interface (CLI), and MySQL Workbench.

Billing

  • You are charged for instance specifications and storage capacity. Fees vary based on billing method, RDS edition, instance type, storage type, and storage capacity.

  • Fees for any application server or third-party client used to connect are not included.

Prerequisites

Before you begin, ensure that you have:

The instance, database, and account from Step 1 are used throughout this topic. Modify them to match your actual setup.

Get your connection details (CLI and client only)

Skip this section if you plan to use DMS. DMS connects without requiring an IP address whitelist or endpoint configuration.

For the CLI and MySQL Workbench, gather these three values before connecting:

DetailExampleHow to get it
Endpointrm-bp**************.mysql.rds.aliyuncs.comSee step 2 below. Valid endpoints use the format rm-xxxxxx.mysql.rds.aliyuncs.com.
Port3306Shown alongside the endpoint.
UsernamedbuserYour privileged account name, set in Step 1.

Step 1: Configure an IP address whitelist

Add your IP address or your application server's IP address to an IP address whitelist for the RDS instance. The endpoint is available only after you configure the whitelist.

Step 2: Get the endpoint

  1. Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where your instance resides, then click the instance ID.

  2. In the Basic Information section, click View Details next to Network Type to see the endpoint and port.

The public endpoint appears only after you apply for one. Click Apply for Public Endpoint if needed. For cluster instances, modify the read/write endpoint in Cluster Read/Write Connection and the read-only endpoint in Cluster Read-only Connection.

Which endpoint to use

ScenarioEndpoint to use
ECS instance in the same region and virtual private cloud (VPC) as the RDS instanceInternal endpoint
ECS instance in a different VPC or regionPublic endpoint
On-premises devicePublic endpoint
Important

Internal network connections require the ECS instance and RDS instance to be in the same region and the same VPC (matching VPC IDs).

Method 1: Log on to the RDS instance in the DMS console

Data Management (DMS) is a one-stop data management platform. Use DMS to log on and manage your database without configuring IP address whitelists or connection types.

  1. Log on to the ApsaraDB RDS console. Select the region where your instance resides, find the instance, and click its ID.

  2. Click Log In to go to the DMS logon page.

    image

  3. In the Log On to Database Instance dialog box, fill in the following fields and click Login.

    • Access Mode: Select Account + password login. Selecting Security Hosting - Automatic (Recommended) enables security hosting, making the instance logon-free going forward.

    • Database Account and Database Password: Use the privileged account dbuser and its password.

    • Control Mode: Select Flexible Management.

    Flexible Management mode is free. Stable Change and Security Collaboration modes provide more features and enhanced database management capabilities, but generate fees. For trial use, select Flexible Management.

    image

  4. In the left-side navigation pane, go to Database Instances > Instances Connected to view your databases. The db_test1 database created in Step 1 appears here.

    information_schema, mysql, performance_schema, sys, and __recycle_bin__ are system databases, not user databases. If your database does not appear, check the following: - Your account may lack permissions. Go to the Accounts page on the RDS instance details page and modify the account's permissions. - The database metadata may not be synced to DMS. Hover over the instance name and click image to sync. You can also use the empty database initialization feature to sync schemas quickly.

    image

Method 2: Connect using the CLI

Use this method to manage the database from a Linux server or on-premises device with MySQL commands.

Important

Complete Get your connection details before proceeding. You also need MySQL installed on the connecting machine.

Install MySQL if needed:

  • CentOS:

    sudo yum install mysql
  • Ubuntu:

    sudo apt-get update
    sudo apt install mysql-server

Connect to the instance:

  1. Log on to your application server or ECS instance.

  2. Run the following command. Replace the endpoint, port, and username with your actual values.

    FlagDescription
    -hEndpoint of the RDS instance (internal or public)
    -PPort number (3306 by default)
    -uUsername of the database account
    -pPrompts for the password after you run the command
    mysql -h <endpoint> -P <port> -u <username> -p

    Example:

    mysql -h rm-bp**************.mysql.rds.aliyuncs.com -P 3306 -u dbuser -p
  3. Enter the password at the Enter password: prompt. If the information similar to the following figure is displayed on the CLI, the RDS instance is connected.

    image

Method 3: Connect using MySQL Workbench

Use this method if you prefer a graphical client. This topic uses MySQL Workbench 8.0.29.

Important

Complete Get your connection details before proceeding. Download and install MySQL Workbench 8.0.29 in advance.

  1. Start MySQL Workbench and go to Database > Connect to Database.

  2. On the Connect to Database page, fill in the connection details.

    ParameterExample valueDescription
    Connection MethodStandard(TCP/IP)Use TCP/IP for direct connections.
    Hostnamerm-bp**************.mysql.rds.aliyuncs.comYour internal or public endpoint. Get it from View Details in the RDS console.
    Port3306The default MySQL port. Confirm in the RDS console.
    UsernamedbuserYour privileged account name.
    PasswordYour passwordYou must specify a custom password.

    image

  3. Click OK to connect.

Troubleshooting

Connection failures generally fall into three categories: network and whitelist issues, authentication issues, and endpoint issues.

Network and whitelist issues

These errors typically mean the IP address whitelist is misconfigured or you are using an internal endpoint without meeting VPC requirements.

Symptoms:

  • Error code 10060: Can't connect to MySQL server on 'rm-bpxxx.mysql.rds.aliyuncs.com'(10060)

  • Cannot Connect to Database Server

  • Your connection attempt failed for user 'xx' to the MySQL server

Solutions:

  1. Verify your IP address is added to the IP address whitelist.

  2. If using the internal endpoint, confirm the ECS instance and RDS instance are in the same VPC. If not, apply for a public endpoint and use that instead.

Authentication issues

`Access denied for user 'xxx'@'xxx' (using password: YES)`

The username or password is incorrect. Verify both on the Accounts page in the RDS console.

Endpoint issues

`Unknown MySQL server host 'xxx' (11001)`

The endpoint is invalid. Valid endpoints use the format rm-xxxxxx.mysql.rds.aliyuncs.com.

`Destination Host Unreachable` when pinging the internal endpoint

Route conflicts are likely the cause. See What do I do if I am unable to connect to an ApsaraDB RDS instance and the "Destination Host Unreachable" error message is displayed?

Client issues

`mysql command not found`

MySQL is not installed. Install it using the commands in Method 2.

`SSL connection error: SSL is required but the server doesn't support it`

Your MySQL Workbench version requires SSL for standard TCP/IP connections, but the server does not support it. Use MySQL Workbench 8.0.29, which supports non-SSL connections.

FAQ

How do I use Function Compute (FC) to get data from my RDS instance?

Install third-party dependencies for your function and use built-in modules to query RDS. For details, see Install third-party dependencies for a function.

How do I import SQL files after connecting?

Use the data import feature in DMS, which supports SQL, CSV, and Excel files.

What's next