All Products
Search
Document Center

ApsaraDB RDS:Resolve connection errors for ApsaraDB RDS for MySQL

Last Updated:Aug 07, 2026

The max_user_connections parameter sets the maximum number of connections allowed for a database on an ApsaraDB RDS for MySQL instance. When a connection attempt triggers one of the following errors, the database has reached its connection limit:

  • has more than 'max_user_connections' active connections

  • User 'xxx' has exceeded the 'max_user_connections' resource

Diagnose the issue

Because the connection limit is already reached, new sessions may fail to open. If you have an active session in Data Management Service (DMS), use it to run the following queries. Otherwise, connect through an Elastic Compute Service (ECS) instance. For connection instructions, see How do I connect to an ApsaraDB RDS instance? or Use DMS to log on to an ApsaraDB RDS for MySQL instance.

Run these two queries to understand the current state:

-- Check the current connection limit for this database user
show variables like 'max_user_connections';

-- List all active sessions and their source IP addresses (Host column)
SHOW PROCESSLIST;

SHOW PROCESSLIST lists every open connection. To summarize connections by client instead of scanning the full list, run an aggregate query:

SELECT user, host, count(*) as ct
FROM information_schema.processlist
WHERE user NOT IN ('aliyun_root','aurora','replicator','system user','event_scheduler')
GROUP BY user, host
ORDER BY ct DESC;

This query excludes internal system accounts and groups the remaining sessions by user and source IP (the host column), so the client holding the most connections appears first.

Alternatively, use the ApsaraDB RDS console:

  1. Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where your instance resides. Find the instance and click its ID.

  2. In the left-side navigation pane, choose Autonomy Services > Diagnostics.

  3. On the Diagnostics page, click the Session Management tab to view all sessions and their details, including User, Hostname, Execution Duration (s), and Status.

For a detailed audit trail of which accounts and IP addresses opened connections, use the SQL Explorer and Audit feature (Autonomy Services > SQL Explorer and Audit). If you have not yet enabled the feature, enable it first. For more information, see Use the SQL Explorer and Audit feature.

The SQL Explorer and Audit feature is billed separately. For pricing details, see Billing rules.

Resolve the issue

Choose the resolution that matches what you found during diagnosis.

Too many idle or long-running sessions

If SHOW PROCESSLIST shows many sessions in a Sleep state or sessions with abnormally long execution durations, connection slots are occupied by idle or stalled threads. Kill the problematic sessions from the Session Management tab in the console, or terminate them using SQL. For step-by-step instructions, see Session management.

Connection limit is too low

If the active session count is legitimately high and the current max_user_connections value is too restrictive, increase the limit:

  1. Confirm that your instance has enough memory to support more connections. Each connection consumes memory, and setting this value too high can cause memory pressure on the instance.

  2. After confirming that memory is sufficient, update the parameter value. For instructions, see Modify the parameters that specify the maximum number of connections. To view the current value before modifying it:

    1. In the ApsaraDB RDS console, go to the instance details page.

    2. In the left-side navigation pane, click Parameters.

    3. On the Modifiable Parameters tab, find max_user_connections.

Issue persists after the above steps

If the connection limit remains a recurring problem: