Last Updated: February 25, 2016
·
332
· semio

Clean up binary logs for mysql

Some times the bin logs will occupy lots of disk space. To clean up the expired bin logs, run following query:

PURGE BINARY LOGS BEFORE '2013-01-01 0:0:0';

Change the time in the query with your preference. Better way to do this is to add expire_logs_days in my.cnf:

expire_logs_days  =   10

Or run follow query if you don't want a mysql restart:

set @@global.expire_logs_days=10;