Home > MySQL and databases > Disable Binary Update Log

Disable Binary Update Log

October 6th, 2009

The binary update log is activated by placing log-bin[=binary_update_log_filename] in mysql configuration file /etc/my.cnf The filename is optional, and if you do not supply it, the log will be named hostname-bin, with hostname being the name of the host. Any extension (the last 3 letters after the dot) you supply will be dropped, as MySQL creates its own, starting at 001. This log stores all updates to the database in an efficient binary format (the deprecated Update Log stores the same data in a less compressed format). The binary log stores each SQL statement that makes a change to the database in the same order as they were executed, and for this reason is useful for restoring backups, or for replication. MySQL comes with an executable binary that allows you to view the contents of the binary update log; (since it is a binary format, viewing it in a text editor is no use). It’s called mysqlbinlog, and can be accessed as follows, to view the sample binary update log.
# mysqbinlog hostname-bin.001

A new binary update log is created each time the server is restarted, or the database server is flushed (with FLUSH LOGS, mysqladmin flush-logs or mysqladmin refresh), as well as when a single update log becomes too big (determined by the value of max_bin_log_size, which you can set in your config file. Each time a new one is created, the extension increments by one, from 001 to 002 and so on. The highest number will then always be the most recent log. The names of the update logs are stored in a binary update log index file. This is given the same name as the other binary update logs, but with the extension .index. A sample index file looks as follows:

./hostname-bin.001
./hostname-bin.002
./hostname-bin.003
./hostname-bin.004
./hostname-bin.005
./hostname-bin.006
./hostname-bin.007
./hostname-bin.008
./hostname-bin.009

As these Binary log files occupy a huge disk space on our servers we need to disable these binary log. Just comment-out or remove the line log-bin from the configuration file. You can also disable server-id=1 which is not useful on our servers.

To disable the Binary Update Log

1) su to root
2) vi /etc/my.cnf

find the following lines and comment-out :-
log-bin
server-id=1

Save the file and restart mysql using
3) /scripts/restartsrv_mysql

MySQL and databases

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.