β οΈ This post links to an external website. β οΈ
I recently dug into the wonderful world of MySQL binlogs! Here a few learnings.
Binlogs (binary logs) are log files that record everything your MySQL server does. Theyβre used for replication or data recovery. Nice to have, but not necessary unless theyβre a defined part of your data recovery strategy.
In MySQL 8, binlogs are enabled by default with 30-day retention. Which can lead to many GiB-sized files.
This retention period can be adjusted like this (7-day retention being set here):
SET GLOBAL binlog_expire_logs_seconds = 604800;If you happen to find lots of unneeded logs, you can set this value and accelerate the purge of excess logs (after a database backup, of course) like this:
PURGE BINARY LOGS BEFORE NOW() - INTERVAL 7 DAY;
continue reading on www.jakeworth.com
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.