This topic describes how to use the SQL Explorer and Audit feature of an ApsaraDB RDS for MySQL instance. This feature is developed based on the full request feature and the SQL Audit feature and incorporates three features: SQL Search, SQL Explorer, and SQL Audit. This feature can help you obtain information about the SQL statements that are executed. You can use the information to troubleshoot various performance issues and identify the sources that incur high risks.

Prerequisites

  • Database Autonomy Service (DAS) Professional Edition is purchased within your Alibaba Cloud account. For more information about how to purchase DAS Professional Edition, see Purchase DAS Professional Edition. For more information about pricing, see DAS Professional Edition.
  • Your RDS instance runs one of the following MySQL versions and RDS editions:
    • MySQL 8.0 on RDS High-availability or Enterprise Edition
    • MySQL 5.7 on RDS High-availability or Enterprise Edition
    • MySQL 5.6
    • MySQL 5.5

Introduction

  • The Search feature is used to query and export the SQL statements that are executed and the information about the SQL statements. The information includes the database, the state, and the execution duration of each SQL statement. For more information, see the "Use the search feature" section of this topic.
  • The SQL Explorer feature is used to perform health diagnosis on SQL statements, troubleshoot performance issues, and analyze business traffic. For more information, see the "Use the SQL Explorer feature" section of this topic.
  • The SQL Audit feature is used to identify risks, such as high-risk SQL statements, SQL injection attacks, and new access sources. For more information, see the "Use the SQL audit feature" section of this topic.

Enable the SQL Explorer and Audit feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click Enable. In the dialog box that appears, click Enable Professional Edition.
    Note If the SQL Explorer feature is enabled for your RDS instance, you can directly click Enable Professional Edition in the dialog box to purchase DAS Professional Edition. For more information about the SQL Explorer feature, see Use the SQL Explorer feature on an ApsaraDB RDS for MySQL instance.

Use the search feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click the Search tab and specify query criteria.
    Parameter Description
    Time range You can specify a time range as the filter condition. Valid values are Last 15 Minutes, Last 1 Hour, Last 3 Hours, Last 6 Hours, Last 12 Hours, or Last 24 Hours.
    Keyword You can specify multiple keywords. Separate each two keywords with a space.
    User You can specify multiple usernames. For example, you can specify the value in the format of user1 user2 user3.
    Database You can specify multiple databases. For example, you can specify the value in the format of DB1 DB2 DB3.
    Operation type You can filter data by operation type, such as SELECT and INSERT.
    Note If you want to specify more query criteria to narrow the search scope, you can click Enable Advanced Query.
  4. Click Query. Then, you can view the search results in the Logs section.
    Note You can click Export in the upper-right corner of the Logs section, specify Exported Fields, specify Export Time Range, and then click OK to export the log list.

Use the SQL Explorer feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click the SQL Explorer tab. Then, you can view the health statuses of the SQL statements that are executed, and troubleshoot performance issues based on the obtained information. For more information about the SQL Explorer feature, see SQL Explorer.

Use the SQL Audit feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click the Security Audit tab. Then, you can identify high-risk SQL statements, SQL injections, and new access sources. For more information about the Security Audit feature, see Security audit.