时间:2021-07-01 10:21:17 帮助过:53人阅读
只执行一次
CREATE DEFINER=`root`@`localhost` EVENT `test2` ON SCHEDULE AT ‘2017-11-17 00:00:00.000000‘ // 只执行一次 ON COMPLETION PRESERVE ENABLE DO insert into events_list values(‘event_now‘, now());
phpmyadmin中可以直接创建事件
5 开启关闭事件调度器
show variables like ‘%event_scheduler%‘;
通过命令行
通过配置文件my.cnf
event_scheduler = 1 #或者ON
查看调度器线程
show processlist;
mysql> show processlist; +----+-----------------+-----------+------+---------+------+------------------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+-----------------+-----------+------+---------+------+------------------------+------------------+ | 2 | root | localhost | NULL | Query | 0 | NULL | show processlist | | 3 | event_scheduler | localhost | NULL | Daemon | 6 | Waiting on empty queue | NULL | +----+-----------------+-----------+------+---------+------+------------------------+----------------
event_scheduler 线程执行中
mysql 事件(Event) 总结
标签:优缺点 ... 总结 管理 关闭 tin 结束 任务计划 操作系统