zoukankan      html  css  js  c++  java
  • mysql定时器

    --查看定时器状态
    SELECT @@event_scheduler;

    --开启定时器
    SET GLOBAL event_scheduler = 1;

    --2.1、创建测试表test
    drop table if exists test;
    create table test
    (
    id int(11) not null auto_increment primary key,
    time datetime not null
    ) engine=innodb default charset=utf8;

    --2.2、创建evevt要调用的存储过程test_proce
    delimiter //
    drop procedure if exists test_proce//
    create procedure test_proce()
    begin
    insert into test(time) values(now());
    end//
    delimiter ;

    --2.4、创建事件test_event(其作用:每隔一秒自动调用test_proce()存储过程)
    drop event if exists test_event;
    create event test_event
    on schedule every 1 second
    on completion preserve disable
    do call test_proce();

    --2.5、开启事件test_event
    alter event test_event on completion preserve enable;

    --2.6、关闭事件test_event
    alter event test_event on completion preserve disable;

    --2.7、查看表test
    select * from test;

  • 相关阅读:
    DOCTYPE
    js——类型转换
    对象Object
    Array数组
    es6学习笔记
    springboot第一个项目【mybatis】
    springboot第一个项目【创建】
    项目管理和流程的拙见
    树莓派 Zero作为飞控图传
    一根数据线玩转树莓派Zero
  • 原文地址:https://www.cnblogs.com/gavinYang/p/11197880.html
Copyright © 2011-2022 走看看