Overview
This topic describes how to terminate sessions on an ApsaraDB RDS for MySQL instance.
Procedure
You can terminate sessions on an ApsaraDB RDS for MySQL instance using one of the following methods:
-
Use the Session Management feature
-
Use the KILL command
A privileged account can terminate all sessions. A standard account can terminate only its own sessions. For more information about account permissions, see account types.
Use session management to terminate sessions
-
Go to the ApsaraDB RDS instance list. In the top navigation bar, select the region of the instance and click its ID.
-
In the left-side navigation pane, choose Autonomy Services > Diagnostics.
-
Click the Session Management tab.
-
On the Session Management page, view the current sessions and terminate unnecessary connections. For more information, see Session Management.
In the session list, select one or more sessions and click End Selected Sessions, or click End All Sessions.
Use the KILL command
-
Connect to the instance using a MySQL command-line tool. For more information, see Connect to an instance.
NoteIf your instance reaches its connection limit, you cannot connect to it using Data Management (DMS) or a MySQL command-line tool. In this case, use the Session Management feature to terminate sessions.
-
Run the following command to view current sessions and find the ID of the session to terminate:
SHOW processlist;The command returns output similar to the following.

-
Run the following command to terminate the session:
KILL [$ID];Note[$ID] is the session ID found in the previous step.
The command returns output similar to the following.

Next steps
You can adjust the values of the wait_timeout and interactive_timeout parameters to control when your instance automatically closes idle connections. For more information, see Set instance parameters.
Changes to these parameters apply only to new sessions. Existing sessions are not affected.
-
For connections in non-interactive mode, you can decrease the value of the
wait_timeoutparameter on the Parameters page in the console. Thewait_timeoutparameter specifies the timeout period, in seconds, for idle non-interactive connections. The default value is 86400 (24 hours). If a non-interactive connection remains idle longer than the specifiedwait_timeoutperiod, the instance automatically closes it. -
For connections in interactive mode, you can decrease the value of the
interactive_timeoutparameter on the Parameters page in the console. Theinteractive_timeoutparameter specifies the timeout period, in seconds, for idle interactive connections. The default value is 7200 (2 hours). If an interactive connection remains idle longer than the specifiedinteractive_timeoutperiod, the instance automatically closes it.
Applies to
-
ApsaraDB RDS for MySQL