All Products
Search
Document Center

What do I do if the "Unknown MySQL server host" or "name or service not known" error message is displayed when I connect to an ApsaraDB RDS for MySQL instance or an ApsaraDB RDS for MariaDB TX instance?

Last Updated: May 19, 2022

Description

When you connect to an ApsaraDB RDS for MySQL instance or an ApsaraDB RDS for MariaDB TX 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

Take note of the following points:

  • Before you perform high-risk operations such as modifying or changing the specifications or data of an Alibaba Cloud instance, we recommend that you familiarize yourself with the disaster recovery and fault tolerance capabilities of the instance to ensure data security.
  • Before you modify the specifications or data of an Alibaba Cloud instance, such as an Elastic Compute Service (ECS) instance or an ApsaraDB RDS instance, we recommend that you create snapshots or enable backups. For example, you can enable log backups for an ApsaraDB RDS instance.
  • If you have granted specific users the permissions on sensitive information, such as logon accounts and passwords, or submitted sensitive information in the Alibaba Cloud Management Console, we recommend that you modify the sensitive information at the earliest opportunity.
  1. 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.

  2. 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 TX