1、创建一个每隔10秒往t1表中插入一条数据的事件
CREATE EVENT IF NOT EXISTS t1 ON SCHEDULE EVERY 10 SECOND
ON COMPLETION PRESERVE
DO INSERT INTO t1(name) VALUES('AAA');
2、开启Mysql的事件计划状态
开启: SET GLOBAL event_scheduler="ON"
关闭:SET GLOBAL event_scheduler="OFF"
CREATE EVENT IF NOT EXISTS t1 ON SCHEDULE EVERY 10 SECOND
ON COMPLETION PRESERVE
DO INSERT INTO t1(name) VALUES('AAA');