Last active
June 12, 2019 04:25
-
-
Save jocoonopa/2d24e0116103213f718cd98698949c2e to your computer and use it in GitHub Desktop.
clear_general_log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
CREATE PROCEDURE clear_general_log() | |
BEGIN | |
SET GLOBAL general_log=0; | |
RENAME TABLE `general_log` TO `general_log_temp`; | |
DELETE FROM `general_log_temp` WHERE `event_time` < DATE(NOW() - INTERVAL 1 DAY); | |
RENAME TABLE `general_log_temp` TO `general_log`; | |
SET GLOBAL general_log=1; | |
END$$ | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment