PDA

View Full Version : Flushing MySQL DB



freddieb
01-14-2004, 03:59 PM
Can anyone tell me how to flush a MySQL databse every hour?

I want to put up a demo CMS so users can input data and change things, but then I want to clear all the imput data out t timed intervals?

Thanks in advance

redcircle
01-14-2004, 05:10 PM
keep track when it was last run if it's greater than an hour delete the data in the database. otherwise continue.

freddieb
01-14-2004, 10:11 PM
Sorry, Redcircle, I didn't explain that I wanted to do it automatically at 1 hour intervals.

redcircle
01-15-2004, 07:11 PM
ok... doing some thinking on your problem I have a better solution. Instead of having it truncate on a set interval why not truncate at the start of every session to the CMS. That way if someone is in the middle of testing the CMS and your 1hour interval comes about then they are going to be confused. Then again if you have more than one person doing the demo they will also be confused...

Personally instead of an hourly flush I'd do a daily flush that way people that are using the demo can get an idea of what others were trying out.

to completely answer your question on a periodic flush you could use a cron job to flush the data every hour.
Here's some information on another forum on the subject http://forums.devshed.com/t5948/s.html

freddieb
01-17-2004, 02:24 AM
Hey, Redcircle, you're the ACE man!