All Products
Search
Document Center

ApsaraDB RDS:Linux "Unknown MySQL server host" is returned when you connect to an apsaradb RDS for MySQL instance

Last Updated:Aug 24, 2023

Problem description

When you connect to the RDS for MySQL instance from an ECS instance in Linux, the following error message is displayed.

Unknown MySQL server host

Cause

The domain name resolution data packet is discarded because iptables is enabled. The following error is reported in the system log.

ECS连接报错

Solution

Note

Alibaba Cloud reminds you that:

  • When you perform operations that have risks, such as modifying instances or data, check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • Before you modify the configurations and data of instances including but not limited to ECS and RDS instances, 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.

The following steps are based on the operating system of the CentOS 6.5, and the parameters for other earlier versions are net.ipv4.ip_conntrack_max.

  1. Log on to the ECS instance and run the following command to edit the sysctl.conf file:
    vim /etc/sysctl.conf
  2. Adjusted based on the actual memory usage. net.nf_conntrack_max of parameter, save and exit.
    net.nf_conntrack_max = 6550400
    The command output is as follows:
    net.nf_conntrack_max
  3. Run the following command to make the configurations take effect:
    sysctl -p
    Note

    Note: When the update kernel parameter, error: "nf_conntrack_max" is an unknown key error reported, need to attach ip_conntrack module, it is recommended to add to /etc/rc.local the startup item.

Application scope

  • ApsaraDB RDS for MySQL