Friday 28 June 2013

Cleaning up MySQL binary logs

While analyzing disk usage, I found that /var/lib/mysql was running into gigabytes. I use MySQL for local testing. So, there is no way I can generate that much data. When I checked the folder out, there were many logs files which were eating up the space. Following the docs, clearing them was rather easy. All I had to do was run the following command on MySQL console.

purge binary logs before '2013-06-28 00:00:00';

Only one catch here: this will work only when log_bin option in my.cnf is not commented out.

No comments: