The max_user_connections parameter specifies the maximum number of connections that are allowed for a database on an AparaDB RDS for MySQL instance. If the "has more than 'max_user_connections' active connections" error message, the "User 'xxx' has exceeded the 'max_user_connections' resource" error message, or an error message related to the max_user_connections parameter is displayed when you connect to a database on an RDS instance, you can use the solutions that are described in this topic to fix this issue.
Problem description
You cannot connect to a database on an RDS instance by using Data Management Service (DMS) or a database client, and an error message related to the max_user_connections parameter is displayed.
Cause
The number of connections to the database on the RDS instance reaches the upper limit.
Problem identification
Log on to the ApsaraDB RDS console
Use the SQL Explorer and Audit feature
After you enable the SQL Explorer and Audit feature for an RDS instance, SQL statements from database kernels, the accounts and IP addresses that are used to execute the SQL statements, and execution details are automatically recorded without affecting the performance of the RDS instance. For more information, see Use the SQL Explorer and Audit feature.
You are charged for the use of the SQL Explorer and Audit feature. For more information, see Feature description and billing rules.
Procedure
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, choose .
Enable the SQL Explorer and Audit feature.
Use the session management feature
You can use the session management feature to view all sessions, active sessions, and abnormal sessions of the RDS instance. You can also view the parameters related to sessions, such as User, Hostname, Execution Duration (s), and Status. For more information, see Use the session management feature.
Procedure
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, choose Autonomy Services > Diagnostics.
On the Diagnostics page, click the Session Management tab to view the parameters related to the current session, such as User, Hostname, Execution Duration (s), and Status.
Use SQL statements
The number of connections to an RDS instance reaches the upper limit. As a result, new sessions cannot be established to the RDS instance and SQL statements cannot be executed. If historical sessions are retained in Data Management (DMS), you can execute SQL statements to view the sessions.
You can connect to an RDS instance from an Elastic Compute Service (ECS) instance or log on to the DMS console to connect to the RDS instance. You can execute the following SQL statement to view the slow threads and handle them. For more information, see the following topics:
SHOW PROCESSLIST;
The following table describes the returned result. The source IP address is displayed in the Host column.
Solution
View the details of the established sessions of the RDS instance
Log on the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
In the left-side navigation pane of the page that appears, choose
.On the page that appears, click the Session Management tab. On the Session Management tab, view the details of the sessions established to the RDS instance. For more information, see Session management.
View the configuration of the max_user_connections parameter of the database on the RDS instance.
You can use one of the following methods to view the value of the max_user_connections parameter:
Log on to the ApsaraDB RDS console.
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
In the left-side navigation pane of the page that appears, click Parameters.
On the Modifiable Parameters tab, view the value of the max_user_connections parameter.
Log on to the database and execute the following statement to view the value of the max_user_connections parameter:
show variables like 'max_user_connections';
After you confirm that the memory resources are sufficient, change the value of the max_user_connections parameter to a larger value. For more information, see Modify the parameters that specify the maximum number of connections.
If the issue persists, use the following methods:
Troubleshoot connection issues of the RDS instance. For more information, see What do I do if the number of connections to an ApsaraDB RDS for MySQL instance reaches the upper limit?
Restart the RDS instance to release connections. For more information, see Restart an RDS instance.