automatically truncate table daily

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
aalbright
Forum Newbie
Posts: 6
Joined: Sun Feb 15, 2009 8:32 pm

automatically truncate table daily

Post by aalbright »

Hi, I've got a question:

How would I be able to automatically truncate a mysql table at midnight every night? Is this not even possible, or really simple?

Thanks.
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: automatically truncate table daily

Post by Darhazer »

You can use an Event if your MySQL version support this. Check out the CREATE EVENT syntax. Or you can write a script to truncate it and set it as a cron.
Post Reply