Description
When you connect to an ApsaraDB RDS for MySQL instance or an ApsaraDB RDS for MariaDB instance, the system displays one of the following error messages:
ERROR 2005 (HY000): Unknown MySQL server host 'xxxxxxx' (110 or 11004)
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
Name or service not known
Cause
The DNS servers cannot resolve the endpoint of the RDS instance.
Solution
Check whether the endpoint of the RDS instance is correct. The endpoint may be incorrect due to one of the following reasons:
The format of the endpoint that you enter is invalid. The valid format is rm-XXX.XXX.rds.aliyuncs.com, as shown in the following figure.
The endpoint that you enter is a public endpoint, which has been manually released.
The endpoint that you enter exceeds the maximum length that is allowed. As a result, the endpoint is truncated.
If the endpoint that you enter is correct but the preceding error message persists, change the DNS server IP addresses to the IP addresses of Alibaba Cloud DNS servers.
If you connect to the RDS instance over the classic network, change the DNS server IP addresses to 10.143.22.116 and 10.143.22.118.
If you connect to the RDS instance over an internal network that is comprised by VPCs, change the DNS server IP addresses to 100.100.2.136 and 100.100.2.138.
If you connect to the RDS instance over the Internet, change the DNS server IP addresses to 223.5.5.5 and 223.6.6.6.
References
You can ping the endpoint of the RDS instance to obtain the IP address of the RDS instance. The IP address may change due to reasons such as migration and primary/secondary switchovers. We recommend that you do not use the IP address to connect to the RDS instance. The endpoint does not change. We recommend that you use the endpoint to connect to the RDS instance.
Application scope
ApsaraDB RDS for MySQL
ApsaraDB RDS for MariaDB