#database #mysql #sysadmin

Today, I learned how to purge the binlogs from MySQL:

1PURGE BINARY LOGS BEFORE now();

You can read more about it in the MySQL documentation:

1PURGE { BINARY | MASTER } LOGS {
2    TO 'log_name'
3  | BEFORE datetime_expr
4}

The binary log is a set of files that contain information about data modifications made by the MySQL server. The log consists of a set of binary log files, plus an index file (see Section 7.4.4, "The Binary Log").

The PURGE BINARY LOGS statement deletes all the binary log files listed in the log index file prior to the specified log file name or date. BINARY and MASTER are synonyms. Deleted log files also are removed from the list recorded in the index file, so that the given log file becomes the first in the list.