Mysql Logs automatically deleted after 3 days

/* 3 days in seconds days variable is a depcreted var dont use it */
SET GLOBAL binlog_expire_logs_seconds = 259200; 

/* if you want to delete right away */
/* delete all the logs older than 3 days */
PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY) + INTERVAL 0 SECOND; 

For more information:

https://gist.github.com/tiagocardosos/0d8e7e95316696be7a400e2c60909c43

http://www.uptimemadeeasy.com/mysql/using-the-mysql-binary-log/

https://dba.stackexchange.com/questions/25841/mysql-changing-expire-logs-days-without-restarting-the-server

Deixe um comentário 0

Your email address will not be published. Required fields are marked *