MySQL tutorial: PURGE BINARY LOGS [EN]
top of page
CerebroSQL

MySQL: 

PURGE BINARY LOGS

Syntax:
PURGE { BINARY | MASTER } LOGS {
TO 'log_name'
| BEFORE datetime_expr
}

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
https://dev.mysql.com/doc/refman/8.0/en/binary-log.html).

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.

PURGE BINARY LOGS requires the BINLOG_ADMIN privilege. This statement
has no effect if the server was not started with the --log-bin option
to enable binary logging.

URL: https://dev.mysql.com/doc/refman/8.0/en/purge-binary-logs.html

Example

PURGE BINARY LOGS TO 'mysql-bin.010';
PURGE BINARY LOGS BEFORE '2019-04-02 22:46:26';

bottom of page