Description:
Operating System: Red Hat Enterprise Linux ES release 4 (Nahant Update 5)
Arch: i386
The default location for 'log-bin' does not appear to be correct as of version 5.0.41.
Referencing the MySQL documentation:
http://dev.mysql.com/doc/refman/5.0/en/binary-log.html
"When started with the --log-bin[=base_name] option, mysqld writes a log file containing
all SQL commands that update data. If no base_name value is given, the default name is the
name of the host machine followed by -bin. If the basename is given, but not as an
absolute pathname, the server writes the file in the data directory. It is recommended
that you specify a basename; see Section B.1.8.1, “Open Issues in MySQL”, for the
reason."
This would imply that if 'log-bin' is implicitly set in my.cnf (just setting 'log-bin'
without '=base_name'), that the binary log will be output to
'/var/lib/mysql/<hostname>.XXXXXX'. However, as of 5.0.41 the log is output to
'/var/run/mysqld/mysql-bin.XXXXXX'. If *explicitly* set, the log outputs to
'/var/lib/mysql/<base_name>.XXXXXX' as expected.
Please note that I did read 'http://dev.mysql.com/doc/refman/5.0/en/open-bugs.html' and
did not find anything that sounds relative.
In summary, if log-bin is not explicitly configured for a specific log 'base_name', the
default 'datadir' is *not* used and the binary log is created in '/var/run/mysqld'. The
following show both configurations:
With log-bin explicitly configured:
[rpm-dev@rhel-i386-es-4_test ~]$ date
Tue May 22 15:19:46 CDT 2007
[rpm-dev@rhel-i386-es-4_test ~]$ cat /etc/my.cnf | grep log-bin
log-bin=myserver
mysql> SHOW MASTER STATUS;
+-----------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-----------------+----------+--------------+------------------+
| myserver.000001 | 98 | | |
+-----------------+----------+--------------+------------------+
1 row in set (0.00 sec)
[rpm-dev@rhel-i386-es-4_test ~]$ ls -lah /var/lib/mysql/myserver.000001
-rw-rw---- 1 mysql mysql 98 May 22 15:19 /var/lib/mysql/myserver.000001
With log-bin implicitly set:
[rpm-dev@rhel-i386-es-4_test ~]$ date
Tue May 22 15:09:41 CDT 2007
[rpm-dev@rhel-i386-es-4_test ~]$ cat /etc/my.cnf | grep log-bin
log-bin
mysql> SHOW MASTER STATUS;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| mysqld-bin.000003 | 98 | | |
+-------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
[rpm-dev@rhel-i386-es-4_test ~]$ ls -lah /var/run/mysqld/mysqld-bin.000003
-rw-rw---- 1 mysql mysql 98 May 22 15:10 /var/run/mysqld/mysqld-bin.000003
The severity is marked as Serious as this issue breaks replication when upgrading to MySQL
5.0.41 (if log-bin is not explicitly set with a base_name).
How to repeat:
Set 'log-bin' in /etc/my.cnf without '=base_name'. Restart MySQL and verify binary log
location. In this case, the log is output to '/var/run/mysql' and not '/var/lib/mysql'.
Suggested fix:
If no base_name is supplied, the logfile should be created as '<hostname>-bin.XXXXXX' in
the datadir (/var/lib/mysql).