How can we get the metadata of MySQL events?

MySQLMySQLi Database

It can be done with the help of the INFORMATION_SCHEMA database. The following statement will give us the metadata of events −

mysql> SELECT * from INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME LIKE '%event%' A

ND EVENT_SCHEMA = 'query'\G
*************************** 1. row ***************************
      EVENT_CATALOG: def
       EVENT_SCHEMA: query
         EVENT_NAME: testing_event6
            DEFINER: root@localhost
          TIME_ZONE: SYSTEM
         EVENT_BODY: SQL
   EVENT_DEFINITION: INSERT INTO event_message(message,generated_at) values('EVENT ALTERED', NOW())
         EVENT_TYPE: ONE TIME
         EXECUTE_AT: 2017-11-22 20:03:52
     INTERVAL_VALUE: NULL
     INTERVAL_FIELD: NULL
           SQL_MODE: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
             STARTS: NULL
               ENDS: NULL
             STATUS: DISABLED
      ON_COMPLETION: PRESERVE
            CREATED: 2017-11-22 20:02:52
       LAST_ALTERED: 2017-11-22 21:01:17
      LAST_EXECUTED: 2017-11-22 20:03:52
       EVENT_COMMENT:
          ORIGINATOR: 0
CHARACTER_SET_CLIENT: cp850
COLLATION_CONNECTION: cp850_general_ci
  DATABASE_COLLATION: latin1_swedish_ci

*************************** 2. row ***************************

       EVENT_CATALOG: def
        EVENT_SCHEMA: query
          EVENT_NAME: testing_event_with_preserves
             DEFINER: root@localhost
           TIME_ZONE: SYSTEM
          EVENT_BODY: SQL
    EVENT_DEFINITION: INSERT INTO event_MESSAGES(Message, generated_at) Values('Altered',NOW())
          EVENT_TYPE: RECURRING
          EXECUTE_AT: NULL
      INTERVAL_VALUE: 1
      INTERVAL_FIELD: MINUTE
            SQL_MODE: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
              STARTS: 2017-11-22 21:03:01
                ENDS: NULL
              STATUS: DISABLED
       ON_COMPLETION: PRESERVE
             CREATED: 2017-11-22 20:35:12
        LAST_ALTERED: 2017-11-22 21:04:42
       LAST_EXECUTED: 2017-11-22 20:35:12
       EVENT_COMMENT:
          ORIGINATOR: 0
CHARACTER_SET_CLIENT: cp850
COLLATION_CONNECTION: cp850_general_ci
  DATABASE_COLLATION: latin1_swedish_ci
2 rows in set (0.00 sec)
raja
Published on 22-Feb-2018 13:00:59
Advertisements