All Products
Search
Document Center

:Exports slow MySQL log data to a local disk

Last Updated:May 20, 2022

Overview

This topic describes how to export slow MySQL log data to a local disk.

Detail

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

Connect to the RDS instance in your local area and run the following SQL statements in sequence to export slow logs:

tee [$Flie]
select * from mysql.slow_log\G

Note:[$Flie] is a file used for storing exported data. The specific path is subject to the actual environment. You can view the exported data locally.

Application scope

  • ApsaraDB RDS instance