I am using 5.7.37-log MySQL Community Server. my mysqld.cnf looks below:
server_id = 11
log_bin = bin.log
log-bin-index = bin-log.index
binlog_format = row
max_binlog_size = 100M
socket = mysql.sock
expire_logs_days = 1
my expectation with expire_logs_days = 1 is that after 1 day the log will be purged. and i wont be able to see the older logs.. but when i check logs after a week, i can still see bin.000001, when the current log name is bin.000006. and I observed the old logs are getting purged when I restart mysql server and a new log is being created.
But I dont want to restart the server to get my old files deleted. they should be deleted automatically. and i fear about filling up disk space when i accumulate older logs (i dont need them for sure) and i dont want to restart sql server for this purpose.
I also had seen in some forms suggesting to run PURGE BINARY LOGS BEFORE NOW() - INTERVAL 1 DAY;
But I dont understand the point in manually running above statement when we already set the config.
Please help me if my understanding and expectations were correct or not. and how do i test or make sure that the logs are getting deleted automatically ? and no harm to disk space.
attaching screenshot of my generated bin logs.
max_binlog_size
.