How do I automate MySQL Update or Insert upon expire timestamp?
So let say timestamp is 2013-06-30 20:10:00
and I would like to auto update MySQL DB upo
Use can use for that
If you go with option 1 you need to create an event
CREATE EVENT myevent
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
UPDATE myschema.mytable
SET mycol = mycol + 1;
Use SHOW PROCESSLIST
to check if event scheduler is enabled. If it's ON
you should see a process "Daemon" by user "event_scheduler". Use SET GLOBAL event_scheduler = ON;
to enable the scheduler if it's currently not enabled. More on configuring event scheduler here.
If you want to see events that you've in your schema
SHOW EVENTS;
UPDATE Your update statement should look like
UPDATE online_auctions
SET auction_status = 'ENDED'
WHERE auction_end_date < NOW();
Here is SQLFiddle demo