Skip to content

Commit c3e2977

Browse files
author
Arun Kuruvila
committed
Bug #16570238: MYSQL_INSTALL_DB IGNORES /ETC/MY.CNF IN 5.6
Description: The "mysql_install_db" utility ignores the default options specified in the default configuration files. Consider that the data directory path was specified in any one of the default file eg. in "/etc/my.cnf", the values for the options are read from the files in the order as specified below: /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf. Since "mysql_install_db" ignores these files when the default-file option is not specified and uses the generated "my.cnf" defaults file in the installation directory. Hence the data directory resides in the installation directory after "mysql_install_db". When the mysqld server is started, it will start scanning the defaults files specified in the above list and hence would find a conflicting data directory option value. Analysis: The "mysql_install_db" utility creates a default option file named "my.cnf" in the base installation directory. And this newly created "my.cnf" file is used as the default-file when "--default-file" option is not explicitly specified by the user. So this will skip reading of default options from the configuration files specified in the above list. Fix: Whenever default file is not explicitly specified by the user, newly created "my.cnf" is not set as the default-file. This will make "mysql_install_db" utility to read default options from the default configuration files in the order specified above. NOTE:- mtr test case is not added since it needs root permission to create configuration files in default locations.
1 parent 06c9dd7 commit c3e2977

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

scripts/mysql_install_db.pl.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,19 +508,19 @@ if ( ! $keep_my_cnf ) {
508508
# in the my.cfg file, then re-run to merge with command line arguments.
509509
# ----------------------------------------------------------------------
510510

511-
my $print_def_file;
511+
my $cmd;
512+
my @default_options;
512513
if ( $opt->{'defaults-file'} )
513514
{
514-
$print_def_file= $opt->{'defaults-file'};
515+
$cmd = quote_options($print_defaults,
516+
"--defaults-file=$opt->{'defaults-file'}",
517+
"mysqld", "mysql_install_db");
515518
}
516519
else
517520
{
518-
$print_def_file= $config_file;
521+
$cmd = quote_options($print_defaults, "mysqld", "mysql_install_db");
519522
}
520523

521-
my @default_options;
522-
my $cmd = quote_options($print_defaults,"--defaults-file=$print_def_file",
523-
"mysqld","mysql_install_db");
524524
open(PIPE, "$cmd |") or error($opt,"can't run $cmd: $!");
525525
while ( <PIPE> )
526526
{

0 commit comments

Comments
 (0)