All Products
Search
Document Center

How do I terminate Sessions in an apsaradb RDS for MySQL instance?

Last Updated: Dec 24, 2020

Introduction

This article describes how to terminate Sessions in an apsaradb RDS for MySQL instance.

 

Background

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.

Describes two methods to terminate Sessions in apsaradb RDS for MySQL.

 

Terminated by DMS

  1. Log on to the RDS Database. For more information about how to log on to the RDS Database, see log on to the RDS Database through DMS.
  2. Click performance at the top of the page. > Instance session.
  3. In the dialog box that appears, select a new version and authorize it. You must authorize the account only for your first logon.
  4. Shift and Ctrl to select sessions, and then kill selected sessions to terminate these sessions.
    kill会话

 

Run the kill command to terminate the

  1. Connect to an RDS for MySQL instance by using a MySQL CLI tool. For more information, see connect to instances.
    Tips: The RDS instance is full, when the number of connections is full, you cannot connect to the instance through DMS or the MySQL command line tool. If you cannot connect to the RDS instance by using DMS or the MySQL CLI, we recommend that you set the wait_timeout parameter in the parameter settings section to a small value, for example, 60, so that the RDS instance closes connections that are idle for more than 60 seconds. Then, you can use DMS or MySQL CLI to connect to the instance.
  2. Run the following command to view the current session and record the Id of the session to be terminated.
    show processlist;
    The following command output is returned.
    命令行查看会话
  3. Run the following command to terminate a session:
    kill [$ID];
    Note:[$ID] indicates the Id recorded in the previous step.
    The following command output is returned.
    命令行kill会话

 

Application scope

  • ApsaraDB RDS for MySQL