Home  >  Article  >  Database  >  mysql事件的开启和调用

mysql事件的开启和调用

WBOY
WBOYOriginal
2016-06-07 16:28:46899browse

检测事件是否开启 show variables like 'event_scheduler'; 2.开启事件 set global event_scheduler = on; 3.创建一个存储过程 delimiter // create procedure test() begin update project set create_time = now(); end; 4.创建一个事件 create event if n

检测事件是否开启


 show variables like 'event_scheduler';

    2.开启事件


 set global event_scheduler = on;

  3.创建一个存储过程


delimiter //
create procedure test()
begin
update project set create_time = now();
end;

  4.创建一个事件


create event if not exists e_test
on schedule every 30 second
on completion preserve
do call test();

   5.关闭或开启执行事件


alter event event_name on completion preserver [enable | disable]

  6.删除事件


 drop event event_name;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn