时间:2021-07-01 10:21:17 帮助过:2人阅读
DATE_ADD 后
获取当前时间 SELECT NOW();
2、EVENT
--查看是否开启定时器
show variables like ’%sche%’;
--开启定时器
set global event_scheduler =1;
--改变分隔符
mysql> delimiter //
--创建存储过程
mysql> create procedure PRO_lqy_test_insert_23()
-> begin
-> insert into lqy_test(title,content,createtime) values(‘title titles‘,‘con
tent contents‘,now());
-> end//
Query OK, 0 rows affected (0.00 sec)
--创建事件,每天15:15:00执行
mysql> create event EVENT_lqy_test_insert_23
-> on schedule
-> every 1 day starts ‘2012-04-24 15:15:00‘
-> do call PRO_lqy_test_insert_23()//
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
--启动事件
mysql> alter event EVENT_lqy_test_insert_23 on
-> completion preserve enable;
Query OK, 0 rows affected (0.00 sec)
--关闭事件
mysql> alter event EVENT_lqy_test_insert_23 on
-> completion preserve disable;
Query OK, 0 rows affected (0.00 sec)
mysql的Event 及 时间 操作
标签: