Binary logs (as the name suggests) store data in binary format and are consumed by mysqlbinlog.
In order to prune the logs lets firstly locate the appropraite directory -- in my case this is /var/lib/mysql
cd /var/lib/mysql
ls
-rw-rw---- 1 mysql mysql 104871967 Jan 01 00:00 BINLOG.000001
-rw-rw---- 1 mysql mysql 104885618 Jan 02 00:00 BINLOG.000002
-rw-rw---- 1 mysql mysql 104866713 Jan 03 00:00 BINLOG.000003
We can then either purge by file:
mysql -u user -p
PURGE BINARY LOGS TO 'BINLOG.000002';
or date:
PURGE BINARY LOGS BEFORE '2017-01-02 00:00:00';
*Warning* Simply deleting the files is extremely dangerous - since the logs do not get removed from the index!
No comments:
Post a Comment