Home >Database >Mysql Tutorial >mysql事件的开启和调用_MySQL

mysql事件的开启和调用_MySQL

WBOY
WBOYOriginal
2016-06-01 13:04:541077browse

检测事件是否开启

代码如下:


 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