Tuesday, December 24, 2013

mysql-bin.* files are taking up all the space

If mysql-bin.* files are taking up all the space, you can use the following steps to clear the space:

log in to mysql as root

then run this command to clear all log up until now:

PURGE BINARY LOGS BEFORE NOW();

Or run this if you want to clear it up to certain date:

PURGE BINARY LOGS BEFORE '2010-08-02 22:46:26';



To change the number of date the log retain, say 14 days:

Edit /etc/my.cnf

Add this line: expire_logs_days=14
Restart mysql

Verify it by running this sql:

select @@expire_logs_days;