Can I delete MySQL-bin files?
There is a concise answer to this question: NO.
You should not delete these files from the OS. The easiest way to handle the issue is to let MySQL do the work for you.
mysql-bin.[index] keeps a list of all binary logs MySQLd has generated and auto-rotated. The mechanisms for cleaning out the binlogs in conjunction with
- to run these commands you must first log into MySQL Server
PURGE BINARY LOGS TO 'binlog.001486'; PURGE BINARY LOGS BEFORE 'datetimestamp';
The first example will clear all binary logs before the binlog file binlog.001486. The second will clear any log before the timestamp you specified.
PURGE BINARY LOGS TO 'binlog.001486';
We erase all binary logs before binlog.001486
if we run:
PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY) + INTERVAL 0 SECOND;
This will erase all binary logs before midnight three days ago.
To have binlog rotated automatically and keep three days worth of logs, use this command:
SET GLOBAL expire_logs_days = 3;
add this to