SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30');
SET GLOBAL event_scheduler=off;
CREATE TABLE t1 (a INT);
CREATE OR REPLACE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db1;
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10);
Warnings:
Warning	1105	Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME	EVENT_DEFINITION
ev1	INSERT INTO t1 VALUES (10)
SET GLOBAL event_scheduler=on;
SELECT DISTINCT a FROM t1;
a
10
SET GLOBAL event_scheduler=off;
DELETE FROM t1;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
ERROR HY000: Event 'ev1' already exists
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME	EVENT_DEFINITION
ev1	INSERT INTO t1 VALUES (10)
CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12);
Warnings:
Note	1537	Event 'ev1' already exists
Warning	1105	Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME	EVENT_DEFINITION
ev1	INSERT INTO t1 VALUES (10)
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13);
Warnings:
Warning	1105	Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME	EVENT_DEFINITION
ev1	INSERT INTO t1 VALUES (13)
SET GLOBAL event_scheduler=on;
SELECT DISTINCT a FROM t1;
a
13
SET GLOBAL event_scheduler=off;
DELETE FROM t1;
DROP EVENT IF EXISTS ev1;
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME	EVENT_DEFINITION
DROP EVENT IF EXISTS ev1;
Warnings:
Note	1305	Event ev1 does not exist
DROP EVENT ev1;
ERROR HY000: Unknown event 'ev1'
SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME	EVENT_DEFINITION
DROP TABLE t1;
SET timestamp=DEFAULT;
