All Products
Search
Document Center

:Terminate sessions on an RDS for MySQL instance

Last Updated:Jun 21, 2026

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

Important

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

  1. Go to the ApsaraDB RDS instance list. In the top navigation bar, select the region of the instance and click its ID.

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

  3. Click the Session Management tab.

  4. 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

  1. Connect to the instance using a MySQL command-line tool. For more information, see Connect to an instance.

    Note

    If 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.

  2. 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. 命令行查看会话

  3. 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. 命令行kill会话

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.

Important

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_timeout parameter on the Parameters page in the console. The wait_timeout parameter 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 specified wait_timeout period, the instance automatically closes it.

  • For connections in interactive mode, you can decrease the value of the interactive_timeout parameter on the Parameters page in the console. The interactive_timeout parameter 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 specified interactive_timeout period, the instance automatically closes it.

Applies to

  • ApsaraDB RDS for MySQL