Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sysadminbp/4836196f51b21e5a12f6af149c5cc949 to your computer and use it in GitHub Desktop.
Save sysadminbp/4836196f51b21e5a12f6af149c5cc949 to your computer and use it in GitHub Desktop.
SHOW GLOBAL VARIABLES LIKE 'expire_logs_days' ; - shows how much days are set now
======
SET GLOBAL expire_logs_days = 3; - sets variable for 3 days
/etc/my.cnf:
[mysqld]
expire_logs_days=3
=========
PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY) + INTERVAL 0 SECOND; - this will erase all binary logs before midnight 3 days ago.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment