Bug #3581 | binary log dir defaults to default data dir | ||
---|---|---|---|
Submitted: | 27 Apr 2004 16:07 | Modified: | 30 Apr 2004 15:31 |
Reporter: | John Wobus | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Installing | Severity: | S3 (Non-critical) |
Version: | 4.015 | OS: | Solaris (Solaris 8) |
Assigned to: | Guilhem Bichot | CPU Architecture: | Any |
[27 Apr 2004 16:07]
John Wobus
[28 Apr 2004 14:53]
Guilhem Bichot
Hello, I have tried what was suggested: "my.cnf includes the mysqld line 'log-bin' and the command line specifies a data directory" and the binary logs were still created in the directory specified in --datadir in the command line. So I can't repeat the problem. And looking at the code, I can't understand how this could happen. Could you please provide detailed instructions explaining what you do to repeat the problem? Thank you. Guilhem
[30 Apr 2004 15:31]
Guilhem Bichot
User was confused by the fact that if datadir is specified in my.cnf, and --log-bin (no argument) is used on the command line then the binlog is created in the datadir, whereas if the datadir is not specified in my.cnf then it is created in the specified-at-build-time datadir. To avoid usage of any my.cnf by mysqld (or other MySQL programs), solution is to use --no-defaults (as the first option).
[30 Apr 2004 20:12]
John Wobus
I tracked my log-bin problem to two mysqld behaviors, one of which I found documented in my O'Reilly 2002 edition of the reference manual. As I suspected might be the case, the behaviors involve the use of my.cnf along with the command line. The behavior that is documented is the exact location of DATADIR/my.cnf. Specifically, O'Reilly in 4.1.2 (page 218) says: "DATADIR is the MySQL data directory (typically /usr/local/mysql/data for a binary installation or /usr/ local/var for a source installation). Note that this is the directory that was specified at configuration time, not the one specified with --datadir when mysqld starts up! ) --datadir has no effect on where the server looks for option files because it looks for them before it processes any command-line arguments)." I can imagine how this simplifies the program logic. But I suggest that referring to the config file's location as DATADIR/my.cnf is misleading. The location is "DATADIR/my.cnf" under certain conditions, but under other conditions, it is not. The other behavior that confused me is this: when I put "--log-bin=foo" on the command line, expecting this to override whatever the my.cnf files say about binary logging, it does so. However, when I use just "--log-bin", expecting mysqld to use the default path, DATADIR/HOSTNAME-bin, then I find mysqld does indeed log but if a my.cnf is specifying a filename or path, it uses that one. Once again, I can imagine doing otherwise would complicate the programming logic as well as the user's mental model of how variables are set in general, but it misled me. I set the command line parameters to do what I needed and found mysqld using values I didn't even realize it would look for. Through the combination of these two behaviors, it took me a while to figure out what was going on. John Wobus