shell 定时任务:
​/usr/bin/mysql -uroot -pxxxxx databasename -e "update table set ......."

​mysql event:

查看event是否开启:
mysql> show variables like '%sche%';
event_scheduler | ON

将事件计划开启 : SET GLOBAL event_scheduler = 1;
将事件计划关闭 : SET GLOBAL event_scheduler = 0;

关闭事件任务 : ALTER EVENT eventName ON COMPLETION PRESERVE DISABLE;
开启事件任务 : ALTER EVENT eventName ON COMPLETION PRESERVE ENABLE;

查看事件任务 : SHOW EVENTS ;

DELIMITER //
CREATE PROCEDURE yoon ()
BEGIN
update a SET id = 2 WHERE id = 1;
END //

create event if not exists e_yoon
on schedule every 10 second
on completion preserve
do
begin
call yoon();
end //


以上事件e_yoon表示每10秒执行一次yoon()

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-09-08
  • 2021-09-08
猜你喜欢
  • 2021-07-03
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2021-11-19
  • 2021-08-30
相关资源
相似解决方案