All Products
Search
Document Center

AnalyticDB:Connections

Last Updated:Mar 28, 2026

Answers to common connection issues with AnalyticDB for MySQL clusters.

Can't connect to MySQL server

This error almost always means the client's IP address isn't in the cluster's whitelist. Fix it in three steps:

  1. Check whether the correct public IP address of the client is used.

    ECS instance

    Log in to the ECS console, find the instance connecting to the cluster, and copy its IP address. Use the private IP if you're connecting through the cluster's private endpoint; use the public IP otherwise. image

    On-premises device

    Run the following command in a terminal or Command Prompt (CMD) window to get the public IP: curl ipinfo.io/ip image

  2. Add the IP address to the cluster's IP address whitelist.

  3. Reconnect to the cluster.

Unknown MySQL server host

This error indicates an incorrect endpoint — either a typo or the wrong endpoint type for your network setup.

First, verify the endpoint spelling. Then run the following command to check connectivity:

ping <endpoint of AnalyticDB for MySQL>

If ping fails, the most common cause is a Virtual Private Cloud (VPC) mismatch:

  • Connecting from an on-premises device using a VPC endpoint — VPC endpoints only work within the same VPC, and on-premises devices are outside any VPC.

  • Connecting from an ECS instance in a different VPC than the cluster.

Check the VPC IDs in both consoles:

VPC ID of the ECS instanceVPC ID of the AnalyticDB for MySQL cluster
imageimage

If the VPC IDs differ, either change the cluster's VPC or switch to the public endpoint. To get the public endpoint:

  1. Log in to the AnalyticDB for MySQL console and copy the public endpoint from the cluster details page.

    If no public endpoint is shown, click Apply for Endpoint. Applying for a public endpoint is free. See Apply for or release a public endpoint for details.
  2. Run ping <public endpoint of AnalyticDB for MySQL> to confirm the endpoint resolves correctly.

  3. Reconnect using the public endpoint.

General connection failure

If you failed to connect to an AnalyticDB for MySQL cluster, use the following troubleshooting flowchart to identify and resolve the issue:

image

如何解决白名单设置问题导致的连接失败?

未设置IP白名单

设置白名单的具体操作,请参见设置白名单

设置的IP不是正确的客户端出口IP

客户端出口IP是指客户端所在本地网络环境中用于访问外部网络的网关设备的IP,并不一定是客户端的本地IP地址。您可以通过以下方式获取正确的客户端出口IP。

  • 推荐联系客户端所在网络环境的网络管理员确定具体有哪些出口IP,此方法可以获得更准确和更全面的出口IP。

  • 如需在相同VPC内通过内网访问,IP白名单为客户端ECS的IP或者VPC网段。

    Note

    VPC网段地址查询方法:登录云原生数据仓库AnalyticDB MySQL控制台,在集群信息页面查询VPC ID。然后登录专有网络控制台,在专有网络页面根据VPC ID查询网段。

  • 如需通过公网访问,可以借用第三方工具获取客户端出口IP。

    • 浏览器打开https://www.ip138.com/网址,网页中显示客户端出口IP。

    • 在客户端命令行执行curl "http://myip.ipip.net"获取客户端出口IP。

IP白名单中的客户端出口IP设置不全

  • 客户端出口IP通常不止一个,如使用第三方工具获取IP,建议多执行几次curl "http://myip.ipip.net",收集全所有的客户端出口IP。

  • 如果您的IP地址较多,可以填写IP段。例如将IP地址192.168.0.1改为IP段192.168.0.0/24。

已开通公网,且公网地址可以ping通,但JDBC连接失败

执行curl ipinfo.io/ip命令,查看公网IP地址,并将该地址添加到白名单中。

If a Java Database Connectivity (JDBC) connection is closed mid-query, does the query stop?

It depends on how the query was submitted:

  • Asynchronous queries — submitted via SUBMIT JOB, INSERT INTO SELECT, or CREATE TABLE AS SELECT — continue running on the server after the JDBC connection closes.

  • All other queries are terminated when the connection closes.

If the client times out but the JDBC connection stays open, are server resources released?

Yes. Server resources are released immediately when the client times out.

Why can't I connect using the EasySwoole framework?

This issue occurs because SHOW statements are not supported in PreparedStatement.

How do I find which users or IPs are creating burst connections?

This applies to Data Warehouse Edition clusters only.
  1. Log in to the AnalyticDB for MySQL console and click the cluster ID of your Data Warehouse Edition cluster.

  2. In the left-side navigation pane, click Diagnostics and Optimization.

  3. Click the Connection Information tab to view Number of User Connections and Number of Connections to Client IP Address.

image

What is the maximum number of connections for a cluster?

There is no hard limit, but the practical maximum varies with cluster specifications. We recommend keeping the total below 50,000 connections per cluster. Low-specification clusters cannot support excessive connections due to insufficient resources. See Limits for per-specification details.