Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
694 views
in Technique[技术] by (71.8m points)

events - How to set a timer in mysql

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

how to implement it?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can declare a fixed point in time for the event's schedule. The interval part is optional.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...