First page Back Continue Last page Image

A MySQL Event that Rotates a log file

USE mysql;

 

DELIMITER //

 

CREATE EVENT general_log_rotate

ON SCHEDULE EVERY 1 MONTH

DO BEGIN

DROP TABLE IF EXISTS general_log_old;

CREATE TABLE general_log_old AS

SELECT *

FROM general_log;

TRUNCATE general_log;

END//