All Products
Search
Document Center

ApsaraDB RDS:Use a client or the CLI to connect to an ApsaraDB RDS for MySQL instance

Last Updated:Mar 28, 2026

Connect to your ApsaraDB RDS for MySQL instance from an Elastic Compute Service (ECS) instance or an on-premises device using the MySQL CLI or a GUI client such as MySQL Workbench or Navicat.

Prerequisites

Before you begin, make sure that you have:

Choose your connection type

Your connection type determines which endpoint to use.

ScenarioEndpoint to useHow to get it
Your ECS instance and RDS instance use the same Alibaba Cloud account, are in the same region, and belong to the same VPCInternal endpointRDS console > Instances > click the instance ID > Basic Information > click View Details next to Network Type
Any other scenario — different account, different region, different VPC, or connecting from an on-premises devicePublic endpointSame path as above. The public endpoint appears only after you click Apply for Public Endpoint.
Connection details
For internal-network connections, get the private IP address of your ECS instance from the Instances page and add it to the RDS IP address whitelist.
Public and private IP addresses
For cross-region or cross-account internal-network connections, VPCs are isolated by default. Use a VPC peering connection (low cost but complex to configure, best for connecting a small number of VPCs) or a Cloud Enterprise Network (CEN) instance (higher cost but simpler to configure, best for connecting a large number of VPCs) to bridge the VPCs. You can also connect over the Internet using the public endpoint — inbound and outbound traffic on the RDS instance is not charged.

Procedure

Connect using the CLI

Install MySQL before connecting:

  • CentOS: sudo yum install mysql

  • Ubuntu: sudo apt-get update then sudo apt install mysql-server

Steps:

  1. Log in to your server (an ECS instance or an on-premises device).

    For ECS login instructions, see the Connect to an instance section in Create and manage an ECS instance by using the ECS console (express version).
  2. Run the connection command:

    -P (uppercase) is the port. -p (lowercase) is the password. The default MySQL port is 3306. Get the username and password from the Accounts page in the instance details.
    mysql -h<Endpoint> -P<Port> -u<Username> -p<Password>

    You can omit the password flag and enter it when prompted.

  3. A successful connection displays the MySQL prompt: Example command: If the connection fails, check the following: For error-specific solutions, see Troubleshooting.

    • Is your client IP address added to the RDS IP address whitelist? Run curl ipinfo.io/ip to get your public IP address, then add it to the whitelist.

    • Are you using the internal endpoint when the ECS and RDS instances don't meet the internal-network conditions? Switch to the public endpoint.

    • Is the endpoint format correct? Valid endpoints follow the format rm-xxxxxx.mysql.rds.aliyuncs.com.

    • Are the username and password correct? Get them from the Accounts page in the instance details.

    Successful connection

    Example command

Connect using MySQL Workbench

This example uses MySQL Workbench 8.0.29. Other MySQL clients follow a similar process.

  1. Download and install MySQL Workbench.

  2. Open MySQL Workbench and choose Database > Connect to Database.

  3. Enter the connection details and click OK.

    The public endpoint appears only after you click Apply for Public Endpoint. For RDS clusters, modify the read/write endpoint in the Cluster Read/Write Connection section and the read-only endpoint in the Cluster Read-only Connection section.
    ParameterDescriptionExample value
    HostnameThe internal or public endpoint of the RDS instance. See Choose your connection type.rm-xxxxxx.mysql.rds.aliyuncs.com
    PortThe port number.3306
    UsernameThe account username. Get it from the Accounts page in the instance details.alice
    PasswordThe account password.

    MySQL Workbench connection dialog

Connect using Navicat

  1. Open Navicat and click Connection in the toolbar. Select the database type to connect to.

    If your Navicat client is outdated, Alibaba Cloud may not appear in the list. Select MySQL or PostgreSQL instead.

    创建连接

  2. Enter the connection details.

    ParameterDescriptionExample value
    Connection NameA name for this connection.my-rds-prod
    HostThe internal or public endpoint of the RDS instance. Use the internal endpoint if the ECS and RDS instances meet internal-network conditions; otherwise use the public endpoint.rm-xxxxxx.mysql.rds.aliyuncs.com
    PortThe port number.3306
    User NameThe account username.alice
    PasswordThe account password.

    连接设置

  3. Click OK.

    If enhanced whitelist mode is enabled and you're connecting over the Internet, add the public IP address of your device to the IP address whitelist of the classic network type.

    连接成功

Troubleshooting

mysql command not found

MySQL is not installed. Install it first:

  • CentOS: sudo yum install mysql

  • Ubuntu: sudo apt-get update then sudo apt install mysql-server

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

Certain MySQL Workbench versions require SSL for standard TCP/IP connections, but the connected server doesn't support SSL. Download MySQL Workbench 8.0.29 to resolve this.

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

  • Most likely cause: The client IP address is not in the RDS whitelist. Run curl ipinfo.io/ip to get your public IP address and add it to the whitelist.

  • Less common cause: You're using the internal endpoint when the ECS and RDS instances don't meet internal-network conditions. Apply for a public endpoint and use it instead.

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

Cannot connect to database server

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

The "Destination Host Unreachable" error message reported when you ping the internal endpoint of the RDS instance

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

The username or password is incorrect. Get the correct credentials from the Accounts page in the instance details.

Unknown MySQL server host 'xxx'(11001)

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

FAQ

Do RDS instances support elastic IP addresses (EIPs)?

No, RDS instances do not support EIPs.

Telnet to my RDS instance fails. What should I check?

Check the following:

  • The service port of the RDS instance is correct and accessible over the Internet.

  • The security group or firewall allows access from your computer's IP address.

  • The hostname and port number are correctly configured.

  • Your computer's firewall doesn't block the port used to connect to the RDS instance.

  • The issue is not Telnet-specific. Use the mysql client or another database management tool to verify connectivity independently.

How do I let another user connect to my RDS for MySQL database?

  1. Create a standard account and grant it the required permissions.

  2. Apply for a public endpoint for the instance.

  3. Configure an IP address whitelist: add the internal IP address or security group ID of the user's ECS instance, or the public IP address of their local client.

  4. Share the public endpoint, database name, account username, and password with the user.

  5. Have the user connect via the CLI.

What's next

References