This topic explains how to resolve connection failures to ApsaraDB RDS instances.
Common connection errors
Find the error message that matches your situation and follow the corresponding solution.
MySQL and MariaDB
Error message | Cause | Solution |
| Network connectivity issue. |
For more information, see Solutions. |
| IP address whitelist configuration issue. | |
| The username or password is incorrect. | Check the username and password in your connection details:
|
| The DNS server cannot resolve the endpoint. |
Note While you can ping the instance to find its current IP address, do not use this IP for connections. The IP address can change during events like migration or a primary/secondary switchover. Always use the endpoint, as it is static. |
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/xx/xx/caching_sha2_password.so: cannot open shared object file: No such file or directory | MySQL cannot load the |
|
| The connection timed out due to inactivity. | This occurs when an idle client connection exceeds the server's timeout period (controlled by parameters like |
Access denied for user 'root'@'XXX' (using password: YES) to database 'XX' | The connection from the ECS instance was rejected because it used the | By default, the MySQL |
From XXX (172.17.XX.XX) icmp_seq=1 Destination Host Unreachable | The ECS instance cannot ping the private endpoint of the RDS instance because the private CIDR block of the RDS instance conflicts with that of another service on the ECS instance. |
SQL Server
Error message | Cause | Solution |
Cannot connect to XXX. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (Microsoft SQL Server, Error: 10060 or 258) | Network connectivity issue. |
For more information, see Solutions. |
Cannot connect to XXX. A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64) | IP address whitelist configuration issue. | |
Logon failed for login 'user' due to trigger execution | The connection limit is reached. | Check the number of connections to the instance and whether there are blocked connections |
cannot open user default database.Login failed | The connecting user's default database lacks an associated user on the ApsaraDB RDS for SQL Server instance. | Create an associated user for the logon user in the database |
From XXX (172.17.XX.XX) icmp_seq=1 Destination Host Unreachable | The ECS instance cannot ping the private endpoint of the RDS instance because the private CIDR block of the RDS instance conflicts with that of another service on the ECS instance. |
PostgreSQL
Error message | Cause | Solution |
Unable to connect to server: could not connect to server: Connection timed out (0x0000274C/10060)Is the server running on host XXX.rds.aliyuncs.com and acceptingTCP/IP connections on port XXX? | Network connectivity issue. |
For more information, see Solutions. |
| IP address whitelist configuration issue. | |
FATAL: remaining connection slots are reserved for non-replication superuser connections | The connection limit is reached. | |
FATAL: password authentication failed for user "xxx". | Incorrect password. | Reset the password and try again. For more information about how to reset the password, see Reset a password. |
From XXX (172.17.XX.XX) icmp_seq=1 Destination Host Unreachable | The ECS instance cannot ping the private endpoint of the RDS instance because the private CIDR block of the RDS instance conflicts with that of another service on the ECS instance. |
DMS connection errors
For related operations, see Connect to an RDS MySQL database by using DMS, Connect to an RDS SQL Server database by using DMS, Connect to an RDS PostgreSQL database by using DMS, and Connect to an RDS MariaDB database by using DMS.
If you reset an account password, you must log on to DMS again.
Error message | Cause | Solution |
The MYSQL server is running with the --rds-deny-access option so it cannot execute this statement |
| Log on to the ApsaraDB RDS console to check whether the instance is locked:
|
Sorry, you cannot access this instance by using DMS at the moment. | You are not the instance owner and have not been granted logon permissions. | |
Please check the correctness of the endpoint, the network connectivity, and the IP address whitelist settings. | This issue typically occurs with self-managed MySQL servers. Possible causes include:
|
For more information, see Solutions. |
max_user_connections | The number of connections to the RDS database has reached the upper limit. | |
Unable to log on to the database due to an IP address whitelist issue. | The DMS service CIDR block is missing from the RDS IP address whitelist. |
ECS cannot access RDS over internal network
To connect to an RDS instance using its private endpoint, you must add the private IP address of the ECS instance to the RDS instance's IP address whitelist.
NoteTo add an IP address whitelist, see Set an IP address whitelist for RDS MySQL, Set an IP address whitelist for RDS SQL Server, Set an IP address whitelist for RDS PostgreSQL, Set an IP address whitelist for RDS MariaDB.
Connecting over the internal network will fail if you only add the ECS instance's public IP address to the RDS IP address whitelist.
The ECS instance and the RDS instance must be in the same region to communicate over the internal network. They can be in the same or different availability zones within the same region.
Make sure that the ECS instance and the RDS instance are in the same region:
View the region of the ECS instance.

View the region of the RDS instance.

If the ECS instance and the RDS instance are in different regions, they cannot communicate directly over the internal network. Use one of the following methods:
Method 1:
Method 2: An ECS instance connects to an RDS instance by using the public endpoint of the RDS instance. This method provides poor performance, security, and stability. For more information about how to apply for a public endpoint, see Apply for a public endpoint for MySQL, Apply for a public endpoint for SQL Server, Apply for a public endpoint for PostgreSQL, or Apply for a public endpoint for MariaDB.
Check the network type
Ensure that the ECS instance and the RDS instance have the same network type (both are in a VPC or both are in the classic network).
View the network type of the ECS instance.

View the network type of the RDS instance.

If one instance is in the classic network and the other is in a VPC, use one of the following methods:
Scenario: The ECS instance is in a VPC, and the RDS instance is in the classic network.
Method 1 (recommended): Migrate the RDS instance from the classic network to the VPC of the ECS instance. For more information, see Change the network type.
Method 2: Purchase a new ECS instance that is in the classic network. However, a VPC is recommended because it provides better security.
NoteYou cannot migrate an ECS instance from a VPC to the classic network.
Method 3: An ECS instance connects to an RDS instance by using the public endpoint of the RDS instance. This method offers poor performance, security, and stability. To learn how to request a public endpoint, see Request a public endpoint for MySQL, Request a public endpoint for SQL Server, Request a public endpoint for PostgreSQL, or Request a public endpoint for MariaDB.
Scenario: The ECS instance is in the classic network, and the RDS instance is in a VPC.
Method 1 (recommended): Migrate the ECS instance from the classic network to the VPC where the RDS instance resides. To find the VPC ID of the RDS instance, go to the instance details page and click View Connection Details next to Network Type. For more information, see Example of migrating a single ECS instance.
Method 2: Switch the network type of the RDS instance from VPC to the classic network. However, VPCs provide better security than the classic network. We recommend that you use a VPC.
Method 3: Enable ClassicLink to connect the classic network ECS instance to the VPC RDS instance over the internal network.
NoteIf the network is not connected after you enable ClassicLink, see Troubleshoot network connectivity issues between the classic network and a VPC after a ClassicLink connection is established.
Method 4: An ECS instance connects to an RDS instance by using the public endpoint of the RDS instance. This method has poor performance, security, and stability. For more information about how to apply for a public endpoint, see Apply for a public endpoint for MySQL, Apply for a public endpoint for SQL Server, Apply for a public endpoint for PostgreSQL, or Apply for a public endpoint for MariaDB.
If both the ECS instance and the RDS instance are in a VPC, confirm that they are in the same VPC.
View the VPC ID of the ECS instance.

View the network type of the RDS instance.

If they are in different VPCs, use one of the following methods:
Method 1 (recommended): Migrate the RDS instance to the VPC where the ECS instance resides. For more information, see Change the VPC and vSwitch of an ApsaraDB RDS instance.
Method 2: Use CEN to connect the two VPCs.
Method 3: An ECS instance connects to an RDS instance by using the public endpoint of the RDS instance. This method provides poor performance, security, and stability. For information about how to apply for a public endpoint, see Apply for a MySQL public endpoint, Apply for a SQL Server public endpoint, Apply for a PostgreSQL public endpoint, or Apply for a MariaDB public endpoint.
If the ECS and RDS instances are in the same VPC and region, but you can only connect using the public endpoint (not the private one), and both ping and telnet fail, see An ECS instance cannot connect to an RDS instance due to a routing issue.
Cannot access RDS over the internet
Confirm the public endpoint
Verify that you are using the public endpoint of the RDS instance. This endpoint is available on the Database Connection page in the ApsaraDB RDS console.

Confirm that the public IP address of the local device is added to the IP address whitelist
ImportantThe public IP address of a local device may change. For example, if the public IP address is dynamic, a change in the IP address may cause a connection failure. For a stable connection, use a private connection or configure a sufficiently broad public CIDR block in the IP address whitelist.
Ensure that the correct public IP address of your local device has been added to the RDS IP address whitelist. To troubleshoot, temporarily add
0.0.0.0/0to the IP address whitelist of the database. If you can access the database normally after this change, it means the IP address whitelist is not configured correctly.You can use the following methods to obtain the public IP address of your local device and add this address to an IP address whitelist. For more information, see Configure an IP address whitelist for ApsaraDB RDS for MySQL, Configure an IP address whitelist for ApsaraDB RDS for SQL Server, Configure an IP address whitelist for ApsaraDB RDS for PostgreSQL, or Configure an IP address whitelist for ApsaraDB RDS for MariaDB.
For more information, see the following topics:
Cross-account access
If your ECS instance and RDS instance are in different Alibaba Cloud accounts, use one of the following methods to connect:
Method 1 (recommended): Use a VPC peering connection.
Method 2: Use a RAM role.
Method 3: An ECS instance connects to an RDS instance by using the public endpoint of the RDS instance. This method provides poor performance, security, and stability. For information about how to apply for a public endpoint, see Apply for a public endpoint for a MySQL instance, Apply for a public endpoint for a SQL Server instance, Apply for a public endpoint for a PostgreSQL instance, or Apply for a public endpoint for a MariaDB instance.
References
Applicable to
ApsaraDB RDS