Mysql事件不起作用

Mysql事件不起作用

本文介绍了Mysql事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过phpmyadmin在我的mysql数据库上添加了以下简单测试事件:

I have added the following simple test event on my mysql database via phpmyadmin:

CREATE DEFINER=`root`@`localhost` EVENT `my_event`
ON SCHEDULE EVERY 1 MINUTE STARTS '2013-05-27 00:00:00'
ON COMPLETION NOT PRESERVE ENABLE DO
BEGIN
    UPDATE `test` SET `name`="z";
END

我的环境是mac + MAMP Pro.我希望在一分钟内更改名称为"z"的测试"表上的所有行.但事实并非如此.

My environment is mac + MAMP Pro. I am expecting to change all rows on my 'test' table with name 'z' within a minute. But not happening so.

我是否还需要其他一些东西才能使我的活动开始进行?

Do I have to something additional to get my events start working?

"SHOW PROCESSLIST"的输出:

Output of "SHOW PROCESSLIST":

谢谢.

推荐答案

事件由调度程序运行,调度程序默认情况下不启动.使用SHOW PROCESSLIST可以检查它是否已启动.如果没有,请运行命令

Events are run by the scheduler, which is not started by default.Using SHOW PROCESSLIST is possible to check whether it is started. If not, run the command

 SET GLOBAL event_scheduler = ON;

运行它.

这篇关于Mysql事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-10 22:44