En Fr
Web/database development and more...
« iPod Touch just got better : almost a PDA now!Linux root partition full »

MySQL binary log space (Debian)

10/15/07

English (US) MySQL binary log space (Debian)

Permalink 12:27:40 am, by Francois Planque Email , Categories: Linux stuff

So it turns out that what is filling up my root partition is my MySQL binary logs.

A collection of fat files in /var/log/mysql ...

So I had several options:

  • Move the logs to a different partition
  • Increase the size of the root partition
  • Decrease the size of the logs

The first option is probably the most reasonable one. But since I had other plans for the evening I actually went with the last option: decreasing the size of the logs! :roll:

The magic conf is located in /etc/mysql/my.cnf and the magic line is:

Code:

expire_logs_days = 5

It was set to 10 but I have no idea why I even need 5 days. Aren't those logs only useful until transactions commit to disk, and replication executes. Oh maybe if you have replicated slaves more than 5 days behind the master??

Edit 2009: You can purge the logs up to a specific file with a statement like this:

Code:

PURGE BINARY LOGS TO 'mysql-bin.000666';

2 comments

Comment from: dAniel hAhler [Visitor] Email
dAniel hAhlerAFAIK binary logs are only needed for replication, not with a single server.
..and for "restore operations", as per http://dev.mysql.com/doc/refman/5.0/en/binary-log.html

You might want to disable them completely.
10/15/07 @ 01:50
Comment from: Gordon [Visitor] Email
Gordon^Exactly. Bin logs are only needed for replicated setups. You can disable binlogging by commenting out the appropriate line in my.cnf.
11/30/07 @ 01:42

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)