Reset mysql table automatically

1

I have a database that stores some leads, can you make the tables in this bank reset every day at a certain time or until it reaches so many lines?

I use phpmyadmin in cpanel.

    
asked by anonymous 28.10.2016 / 19:19

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 do based on X lines, just create a trigger ..

    
28.10.2016 / 19:24