MySQL Purge BIN files

Do not delete the files from the file system. MySQL will complain at some time in the future. Save yourself the unnecessary downtime by using PURGE BINARY LOGS command from within MySQL

mysql> SHOW BINARY LOGS;
mysql> PURGE BINARY LOGS BEFORE '2023-01-01 00:00:00';

or

mysql> PURGE BINARY LOGS TO 'mysql-bin.12345';

Change automatic default purge expiry from 30days (default)

For long term set the BIN logs to a shorter time frame

1 day

mysql> SET GLOBAL binlog_expire_logs_seconds = 86400;

3 days

mysql> SET GLOBAL binlog_expire_logs_seconds = 259200;

5 days

mysql> SET GLOBAL binlog_expire_logs_seconds = 432000;

10 days

mysql> SET GLOBAL binlog_expire_logs_seconds = 864000;