Purge binary logs from MySQL

Categories: Databases, MySQL

First log in as root:

mysql -u root -p

Once logged in run these commands to purge the logs and set expiration to one day so they are recycled and do not pile up:

PURGE BINARY LOGS BEFORE DATE(NOW());
SET GLOBAL expire_logs_days = 1;

Then add this to /etc/my.cnf and restart MySQL:

[mysqld]
expire_logs_days = 1

Reference:

https://dba.stackexchange.com/questions/41050/is-it-safe-to-delete-mysql-bin-files

«
»