Reset mysql Table automatically

Asked

Viewed 344 times

1

I have a database that stores some leads, it is possible to reset the tables of this database every day at a certain time or until it reaches so many lines?

Use phpmyadmin in Cpanel.

1 answer

4


You can do with an event:

CREATE EVENT evento_diario
    ON SCHEDULE
        EVERY 1 DAY
        STARTS '2016-11-01 00:00:00' -- Data e hora para iniciar
    COMMENT 'Limpar tabela XPTO'
    DO
        TRUNCATE XPTO;

If you want to make based on X lines, just create a Trigger..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.