Purge mysql log bins older than two weeks automatically
I am glad you found your own answer.

I am sure you found out you can add this to my.cnf

[mysqld]
expire_logs_days = 14


You do not have to restart mysql. You login as root@localhost and run this:

mysql&gt; SET GLOBAL expire_logs_days = 14;


To trigger the auto rotate immediately, run

mysql&gt; FLUSH LOGS;


If you want to zap binary logs from the mysql console that is older that two weeks, use the PURGE BINARY LOGS BEFORE syntax. For example, here is a query to give you midnight two weeks ago from today's date:

SELECT DATE(NOW() - INTERVAL 2 WEEK) + INTERVAL 0 SECOND;


Just apply that query to PURGE BINARY LOGS BEFORE

PURGE BINARY LOGS BEFORE (DATE(NOW() - INTERVAL 2 WEEK) + INTERVAL 0 SECOND);