How to delete all events in MySQL

后端 未结 3 2101
离开以前
离开以前 2021-02-20 02:40

If I want to delete some event I need to query something like \"DROP EVENT IF EXISTS eventname\" But I can\'t find the command of deleting all the events at one t

相关标签:
3条回答
  • 2021-02-20 03:08

    To construct a drop events query, you can do something like this:

    select concat('drop event if exists ', event_name, ';') from information_schema.events;
    
    0 讨论(0)
  • 2021-02-20 03:13

    sample one:

    DELETE FROM mysql.event
        WHERE db = 'myschema'
          AND definer = 'jon@ghidora'
          AND name = 'e_insert';
    

    https://dev.mysql.com/doc/refman/5.1/en/events-privileges.html

    if you can delete the event with DROP EVENT IF EXISTS and re-add it with the new scheduled time.

    To permanently delete an event yourself, you can use DROP EVENT:

    DROP EVENT [IF EXISTS] event_name
    

    https://dev.mysql.com/doc/refman/5.1/en/drop-event.html

    0 讨论(0)
  • 2021-02-20 03:24

    I think you have to use the INFORMATION_SCHEMA.EVENTS table to gather all the active events and then construct and run the DROP EVENT statements.

    0 讨论(0)
提交回复
热议问题