How to remove MySQL binary logs

MySQL binary logs can be safely removed without needing to shutdown the server daemon. However care must be taken to not delete logs that have yet to be read by and MySQL slave servers if replication is being used.

Use the following command from the MySQL CLI running under a user with the "SUPER" privilege such as root.

PURGE BINARY LOGS BEFORE '2011-01-01 00:00:00';

The date in the command above is optional but is handy to make sure only the old logs that slaves have already read are deleted.

Last updated: 01/03/2012