Binary log error in mysql

Set the log-bin variable in your MySQL configuration file, then restart MySQL.

An example my.cnf (on Linux/unix) or my.ini (on Windows) would look like:

[client]
...

[mysqld]
...
log-bin=mysql-bin
---

Once restarted, MySQL automatically creates a new binary log (does so upon every restart). You may also wish to look at the following variables:

server-id        = 1
expire_logs_days = 4
sync_binlog      = 1

Read details on the MySQL documentation. If you're after replication setup (a primary reason for using binary logs), check out Replication configuration checklist.


Line

log-bin=mysql-bin

must placed above lines:

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

You will need to activate binary logging at startup

Add the following lines in /etc/my.cnf under the [mysqld] section

[mysqld]
log-bin=mysql-bin
expire-logs-days=7

Then, run this

service mysql restart

The next time you login to mysql, you will see a binary log listing and will rotate out after 7 days.

The default location of the binary logs will be /var/lib/mysql or where datadir is defined. If you specify a folder before the binlog name, then that folder is the location.

For example

[mysqld]
log-bin=/var/log/mysql-bin
expire-logs-days=7

UPDATE 2012-07-12 02:20 AM EDT

Please restart mysql as follows and tell us if binary logging in on

service mysql restart --log-bin=mysql-bin

Tags:

Mysql