Overview
This topic describes how to terminate sessions on an ApsaraDB RDS for MySQL instance.
Procedure
You can terminate sessions on an RDS instance by using one of the following methods:
Use Data Management (DMS).
Use the kill command.
A privileged account can terminate all sessions. A standard account can terminate only the current session. For more information about account permissions, see Create an account on an ApsaraDB RDS for MySQL instance.
Use DMS to terminate sessions on an RDS instance
Log on to the RDS instance. For more information, see Use DMS to log on to an ApsaraDB RDS for MySQL instance.
Right-click the instance ID and choose Performance > Instance session.
In the dialog box that appears, select the new version of the DAS console and authorize the user to access DAS. Authorization is required only for the first logon.
Click Kill Selected to terminate the session that you select. You can select multiple sessions.
Use the kill command to terminate sessions on an RDS instance
Connect to the RDS instance by using the MySQL command-line tool. For more information, see Use a database client or the CLI to connect to an ApsaraDB RDS for MySQL instance.
NoteWhen the number of connections to the RDS instance reaches the upper limit, you cannot connect to the RDS instance by using DMS or the MySQL command-line tool. In this case, we recommend that you set the wait_timeout parameter to a small value (unit: seconds), such as 60, in the ApsaraDB RDS console. If you set this parameter to 60, the RDS instance automatically terminates the connections that are idle for more than 60 seconds. This way, you can connect to the RDS instance by using DMS or the MySQL command-line tool.
Execute the following statement to record the ID of the session that you want to terminate:
show processlist;
The following figure shows a sample output.
Run the following command to terminate the session:
kill [$ID];
The [$ID] parameter specifies the ID of the session that you want to terminate.
The following figure shows a sample output.
Applicable scope
ApsaraDB RDS for MySQL