Skip to content Skip to sidebar Skip to footer

Automatic Truncate Table In Mysql

I am looking for a way to automatically clean table in MySQL once per day. Is this possible without using cron? The best solution would be a trigger, but any solution is applicable

Solution 1:

One option is MySQL's EVENT scheduler:

CREATE EVENT e_daily
    ON SCHEDULE
        EVERY1DAY
        STARTS '2014-02-23 05:00:00'-- Time to start
    COMMENT 'Descriptive comment'
    DO
        TRUNCATE yourtable;

How to enable event scheduler

Post a Comment for "Automatic Truncate Table In Mysql"