MySQL Forums
Forum List  »  Events (Job Scheduler)

Re: MySQL - Event For Backup on Windows
Posted by: Sam Dean
Date: November 29, 2007 09:49PM

I am also just getting into Events in MySQL 5.1.xx. This has worked for me.
Description of event named yourdbname.ev_yourtable_copy_daily:
At 5 minutes past Midnight copy all new records from yesterday
from yourtable into yourtable_copy

USE yourdbname
DROP EVENT yourdbname.ev_yourtable_copy_daily;
CREATE EVENT yourdbname.ev_yourtable_copy_daily
ON SCHEDULE EVERY 1 DAY STARTS TIMESTAMP(CURRENT_DATE(), '00:05:00')
DO INSERT INTO yourtable_copy
SELECT * FROM yourtable
WHERE LEFT(datetimecolumn, 10) LIKE DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY);

Options: ReplyQuote


Subject
Views
Written By
Posted
6749
September 18, 2007 11:52PM
Re: MySQL - Event For Backup on Windows
4901
November 29, 2007 09:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.