| Bug #73750 | mysqld_multi writes logfile to wrong directory | ||
|---|---|---|---|
| Submitted: | 28 Aug 2014 8:13 | Modified: | 28 Aug 2014 9:46 |
| Reporter: | Hartmut Holzgraefe | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Logging | Severity: | S3 (Non-critical) |
| Version: | 5.6.20, all? | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
[28 Aug 2014 9:46]
MySQL Verification Team
Hello Hartmut, Thank you for the bug report. Verifying based on code inspection. Thanks, Umesh
[28 Aug 2014 9:47]
MySQL Verification Team
// From my local repo
[ushastry@cluster-repo server]$ more mysql-5.0.96/bin/mysqld_multi |grep --color=auto -i logdir
my $logdir= undef();
$logdir= $1;
if (!defined($logdir))
$logdir= "/usr/local/mysql/share" if (-d "/usr/local/mysql/share" && -w "/usr/local/mysql/share");
if (!defined($logdir))
$opt_log= "$logdir/mysqld_multi.log";
#### file will be read from $opt_logdir)
#### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).
[ushastry@cluster-repo server]$
[ushastry@cluster-repo server]$ more mysql-5.1.73/bin/mysqld_multi |grep --color=auto -i logdir
my $logdir= undef();
$logdir= $1;
if (!defined($logdir))
$logdir= "/usr/local/mysql/share" if (-d "/usr/local/mysql/share" && -w "/usr/local/mysql/share");
if (!defined($logdir))
$opt_log= "$logdir/mysqld_multi.log";
#### file will be read from $opt_logdir)
#### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).
[ushastry@cluster-repo server]$
[ushastry@cluster-repo server]$ more mysql-5.5.40/bin/mysqld_multi |grep --color=auto -i logdir
my $logdir= undef();
$logdir= $1;
if (!defined($logdir))
$logdir= "/usr/local/mysql/share" if (-d "/usr/local/mysql/share" && -w "/usr/local/mysql/share");
if (!defined($logdir))
$opt_log= "$logdir/mysqld_multi.log";
#### file will be read from $opt_logdir)
#### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).
[ushastry@cluster-repo server]$
[ushastry@cluster-repo server]$ more mysql-advanced-5.6.21/bin/mysqld_multi |grep --color=auto -i logdir
my $logdir= undef();
$logdir= $1;
if (!defined($logdir))
$logdir= "/usr/local/mysql/share" if (-d "/usr/local/mysql/share" && -w "/usr/local/mysql/share");
if (!defined($logdir))
$opt_log= "$logdir/mysqld_multi.log";
#### file will be read from $opt_logdir)
#### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).
[ushastry@cluster-repo server]$
[ushastry@cluster-repo server]$
[ushastry@cluster-repo server]$
[ushastry@cluster-repo server]$
[ushastry@cluster-repo server]$ more mysql-5.7.4/bin/mysqld_multi |grep --color=auto -i logdir
my $logdir= undef();
$logdir= $1;
if (!defined($logdir))
$logdir= "/usr/local/mysql/share" if (-d "/usr/local/mysql/share" && -w "/usr/local/mysql/share");
if (!defined($logdir))
$opt_log= "$logdir/mysqld_multi.log";
#### file will be read from $opt_logdir)
#### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).

Description: If no datadir is set via option files or command line the log location defaults to: [...] if (!defined($logdir)) { $logdir= "/usr/share/mysql" if (-d "/usr/share/mysql" && -w "/usr/share/mysql"); } [...] (or whatever the "share" path is for the current installation) in the init_log() function inside the script This is a very unexpected location, and AFAICT in violation with the linux file system standard (and Unix practice in general) as /usr should be considered read-only for everything but software installation actions (so that a read-only /usr file system can be shared between multiple installations) How to repeat: Check source of installed mysqld_multi script or just use mysqld_multi with --no-defaults or the exampe my.cnf given in the script itself, then see that you have a "mysqld_multi.log" file in the same directory that the error message translations, charset information, and files like mysql_system_tables.sql are in (usually /usr/share/mysql or /usr/local/mysql/share ...) ... at least if the user executing mysqld_multi had sufficient permissions to write there ... Suggested fix: The default log location should be the default datadir, not pkgdatadir ...