All Products
Document Center

"Unknown MySQL server host" or "name or service not known" error

Last Updated: Jun 22, 2021

Problem description

When you connect to an RDS for MySQL or MariaDB instance, one of the following error messages is displayed:

  • ERROR 2005 (HY000): Unknown MySQL server host 'xxxxxxxxx' (110 or 11004)
  • SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
  • Name or service not known


The DNS server cannot resolve the IP address.

New solution dialog box

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.
  1. Check whether the endpoint (a string) of the RDS instance is correct. Possible causes of errors are as follows:

    • Address input error. the correct format is

    • The Internet address is used, but the internet address has been manually released.

    • The program allows input of an address with a limited length, and the address is truncated by the program.

  2. If the RDS connection address is entered correctly but the above error message is still prompted, change the DNS server address to the DNS server address of Alibaba Cloud.

    • If the requests are accessed through the internal network (classic network), change the IP address to and

    • Change the access mode from intranet (VPC) to and

    • If the access is through the public network, change it to and

Additional information

You can ping the connection address (string) to view the current IP address of the RDS instance. However, we recommend that you do not use an IP address because IP addresses may change when tasks such as migration and primary/secondary switchover are performed. It is recommended that you use a connection string because the connection string always remains the same.

Application scope

  • ApsaraDB RDS for MySQL
  • Apsaradb for MariaDB TX