如何在mysql中设置计时器
假设当前日期是 20141110 10:00pm ,我想让 mysql 更新一个字段,然后将几个字段转储到一个文件中,而日期是 20141201 10:00pm
Suppose the current date is 20141110 10:00pm , I would like to let mysql to update a field and then dump few fields into a file while the date is 20141201 10:00pm
如何实现?
我所知道的是使用事件,但这似乎是在某些间隔时间下使用的.就像每隔几个小时/天/周让事件发生.
What I know is to use event, but this seems to be used under some interval time. like every few hours/days/weeks to make the event happen.
推荐答案
您可以为活动的时间表声明一个固定的时间点.间隔部分是可选的.
You can declare a fixed point in time for the event's schedule. The interval part is optional.
这是出现在手册页上的示例 http://dev.mysql.com/doc/refman/5.6/en/create-event.html
Here's an example that appears on manual page http://dev.mysql.com/doc/refman/5.6/en/create-event.html
mysql> CREATE EVENT e_totals
-> ON SCHEDULE AT '2006-02-10 23:59:00'
-> DO INSERT INTO test.totals VALUES (NOW());
另请注意,您不必使用存储过程.
Note also that you do not have to use a stored procedure.
相关文章