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:
An RDS instance, a MySQL database on the instance, and a privileged account for the RDS instance. For setup instructions, see Step 1: Create an ApsaraDB RDS for MySQL instance and configure databases
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:
| Detail | Example | How to get it |
|---|---|---|
| Endpoint | rm-bp**************.mysql.rds.aliyuncs.com | See step 2 below. Valid endpoints use the format rm-xxxxxx.mysql.rds.aliyuncs.com. |
| Port | 3306 | Shown alongside the endpoint. |
| Username | dbuser | Your privileged account name, set in Step 1. |
Step 2: Get the endpoint
Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where your instance resides, then click the instance ID.
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
| Scenario | Endpoint to use |
|---|---|
| ECS instance in the same region and virtual private cloud (VPC) as the RDS instance | Internal endpoint |
| ECS instance in a different VPC or region | Public endpoint |
| On-premises device | Public endpoint |
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.
Log on to the ApsaraDB RDS console. Select the region where your instance resides, find the instance, and click its ID.
Click Log In to go to the DMS logon page.

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
dbuserand 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.

In the left-side navigation pane, go to Database Instances > Instances Connected to view your databases. The
db_test1database 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
to sync. You can also use the empty database initialization feature to sync schemas quickly.
Method 2: Connect using the CLI
Use this method to manage the database from a Linux server or on-premises device with MySQL commands.
Complete Get your connection details before proceeding. You also need MySQL installed on the connecting machine.
Install MySQL if needed:
CentOS:
sudo yum install mysqlUbuntu:
sudo apt-get update sudo apt install mysql-server
Connect to the instance:
Log on to your application server or ECS instance.
Run the following command. Replace the endpoint, port, and username with your actual values.
Flag Description -hEndpoint of the RDS instance (internal or public) -PPort number ( 3306by default)-uUsername of the database account -pPrompts for the password after you run the command mysql -h <endpoint> -P <port> -u <username> -pExample:
mysql -h rm-bp**************.mysql.rds.aliyuncs.com -P 3306 -u dbuser -pEnter 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.
Method 3: Connect using MySQL Workbench
Use this method if you prefer a graphical client. This topic uses MySQL Workbench 8.0.29.
Complete Get your connection details before proceeding. Download and install MySQL Workbench 8.0.29 in advance.
Start MySQL Workbench and go to Database > Connect to Database.
On the Connect to Database page, fill in the connection details.
Parameter Example value Description Connection Method Standard(TCP/IP)Use TCP/IP for direct connections. Hostname rm-bp**************.mysql.rds.aliyuncs.comYour internal or public endpoint. Get it from View Details in the RDS console. Port 3306The default MySQL port. Confirm in the RDS console. Username dbuserYour privileged account name. Password Your password You must specify a custom password. 
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 ServerYour connection attempt failed for user 'xx' to the MySQL server
Solutions:
Verify your IP address is added to the IP address whitelist.
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.