Background information

You can use Alibaba Cloud Data Management Service (DMS) to cyclically execute an event on an ApsaraDB RDS for MySQL instance. This topic describes how to execute the following cyclic event:

Increase 1 to the value of the test1 field with an ID of 10 every two minutes

Prerequisites

The event scheduler is enabled for the database to which you log on. You can execute the SELECT @@event_scheduler; statement to check whether the event scheduler is enabled.

  • If ON is returned, the event scheduler is enabled.

  • If OFF is returned, the event scheduler is disabled. Execute the SET GLOBAL event_scheduler = ON; statement to enable the event scheduler.

Procedure

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.
  3. Find the target RDS instance and click its ID.
  4. In the upper-right corner, click Log On to DB. Then, use the privileged account of the target RDS instance to log on to the target database. For more information, see Log on to an RDS MySQL instance through DMS.
  5. In the top navigation bar of the Home page that appears, choose Create > Event. The New: Event page appears.
  6. Configure the following parameters.
    Section Parameter Description
    Basic Information Event Name The name of the event.
    Delete It After Expiration
    • Specifies whether to delete the event after the event is executed at the specified point in time.
    • Specifies whether to delete the event after the event is executed at specified intervals for the specified period of time.
    Status The status of the event. Valid values:
    • Enable: The event is executable.
    • Disable: The event is not executable.
    • DISABLI: The event can be executed only on the primary database.
    Annotation The annotation of the event.
    Execute At Fixed Time The point in time at which you want to execute the event.
    Cycle Time The time interval at which you want to execute the event.
    Note The value of this parameter consists of two parts: integer and unit.
    Start Time The start time of the period during which you want to execute the event at intervals.
    End Time The end time of the period during which you want to execute the event at intervals.
    Event Syntax - The SQL statement you want to execute.
    Note The following examples show the time interval at which a cyclic event is executed:
    • Based on the following settings, the event is executed at two-minute intervals after the specified start time.
    • Based on the following settings, the event is executed at one-month intervals after the specified start time.
  7. Click Save. In the Yes dialog box that appears, confirm the SQL statement you want to execute, and click OK.
  8. Execute the SHOW EVENTS statement in the target database to query the cyclic event.
    Note If you want to delete the cyclic event, execute the DROP EVENT <The name of the cyclic event>; statement.