Commit 7d82c6fa authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-543 mysql_install_db doesn't work with blanks in either basedir or datadir path

parent f37610ec
...@@ -248,7 +248,7 @@ fi ...@@ -248,7 +248,7 @@ fi
# Now we can get arguments from the groups [mysqld] and [mysql_install_db] # Now we can get arguments from the groups [mysqld] and [mysql_install_db]
# in the my.cfg file, then re-run to merge with command line arguments. # in the my.cfg file, then re-run to merge with command line arguments.
parse_arguments `$print_defaults $defaults mysqld mysql_install_db` parse_arguments `"$print_defaults" $defaults mysqld mysql_install_db`
parse_arguments PICK-ARGS-FROM-ARGV "$@" parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files # Configure paths to support files
...@@ -298,7 +298,7 @@ fill_help_tables="$pkgdatadir/fill_help_tables.sql" ...@@ -298,7 +298,7 @@ fill_help_tables="$pkgdatadir/fill_help_tables.sql"
create_system_tables="$pkgdatadir/mysql_system_tables.sql" create_system_tables="$pkgdatadir/mysql_system_tables.sql"
fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql" fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
for f in $fill_help_tables $create_system_tables $fill_system_tables for f in "$fill_help_tables" "$create_system_tables" "$fill_system_tables"
do do
if test ! -f "$f" if test ! -f "$f"
then then
...@@ -329,14 +329,14 @@ hostname=`@HOSTNAME@` ...@@ -329,14 +329,14 @@ hostname=`@HOSTNAME@`
# Check if hostname is valid # Check if hostname is valid
if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then then
resolved=`$extra_bindir/resolveip $hostname 2>&1` resolved=`"$extra_bindir/resolveip" $hostname 2>&1`
if test $? -ne 0 if test $? -ne 0
then then
resolved=`$extra_bindir/resolveip localhost 2>&1` resolved=`"$extra_bindir/resolveip" localhost 2>&1`
if test $? -ne 0 if test $? -ne 0
then then
echo "Neither host '$hostname' nor 'localhost' could be looked up with" echo "Neither host '$hostname' nor 'localhost' could be looked up with"
echo "$extra_bindir/resolveip" echo "'$extra_bindir/resolveip'"
echo "Please configure the 'hostname' command to return a correct" echo "Please configure the 'hostname' command to return a correct"
echo "hostname." echo "hostname."
echo "If you want to solve this at a later stage, restart this script" echo "If you want to solve this at a later stage, restart this script"
...@@ -358,16 +358,16 @@ then ...@@ -358,16 +358,16 @@ then
fi fi
# Create database directories # Create database directories
for dir in $ldata $ldata/mysql $ldata/test for dir in "$ldata" "$ldata/mysql" "$ldata/test"
do do
if test ! -d $dir if test ! -d "$dir"
then then
mkdir -p $dir mkdir -p "$dir"
chmod 700 $dir chmod 700 "$dir"
fi fi
if test -w / -a ! -z "$user" if test -w / -a ! -z "$user"
then then
chown $user $dir chown $user "$dir"
fi fi
done done
...@@ -388,15 +388,19 @@ fi ...@@ -388,15 +388,19 @@ fi
# Configure mysqld command line # Configure mysqld command line
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \ mysqld_install_cmd_line()
--basedir=$basedir --datadir=$ldata --log-warnings=0 --loose-skip-innodb \ {
"$mysqld_bootstrap" $defaults "$mysqld_opt" --bootstrap \
"--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 --loose-skip-innodb \
--loose-skip-ndbcluster $args --max_allowed_packet=8M \ --loose-skip-ndbcluster $args --max_allowed_packet=8M \
--default-storage-engine=myisam \ --default-storage-engine=myisam \
--net_buffer_length=16K" --net_buffer_length=16K
}
# Create the system and help tables by passing them to "mysqld --bootstrap" # Create the system and help tables by passing them to "mysqld --bootstrap"
s_echo "Installing MariaDB/MySQL system tables..." s_echo "Installing MariaDB/MySQL system tables..."
if { echo "use mysql;"; cat $create_system_tables $fill_system_tables; } | eval "$filter_cmd_line" | $mysqld_install_cmd_line > /dev/null if { echo "use mysql;"; cat "$create_system_tables" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
then then
s_echo "OK" s_echo "OK"
else else
...@@ -428,7 +432,7 @@ else ...@@ -428,7 +432,7 @@ else
fi fi
s_echo "Filling help tables..." s_echo "Filling help tables..."
if { echo "use mysql;"; cat $fill_help_tables; } | $mysqld_install_cmd_line > /dev/null if { echo "use mysql;"; cat "$fill_help_tables"; } | mysqld_install_cmd_line > /dev/null
then then
s_echo "OK" s_echo "OK"
else else
...@@ -450,11 +454,11 @@ then ...@@ -450,11 +454,11 @@ then
echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !" echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !"
echo "To do so, start the server, then issue the following commands:" echo "To do so, start the server, then issue the following commands:"
echo echo
echo "$bindir/mysqladmin -u root password 'new-password'" echo "'$bindir/mysqladmin' -u root password 'new-password'"
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" echo "'$bindir/mysqladmin' -u root -h $hostname password 'new-password'"
echo echo
echo "Alternatively you can run:" echo "Alternatively you can run:"
echo "$bindir/mysql_secure_installation" echo "'$bindir/mysql_secure_installation'"
echo echo
echo "which will also give you the option of removing the test" echo "which will also give you the option of removing the test"
echo "databases and anonymous user created by default. This is" echo "databases and anonymous user created by default. This is"
...@@ -466,14 +470,14 @@ then ...@@ -466,14 +470,14 @@ then
then then
echo echo
echo "You can start the MariaDB daemon with:" echo "You can start the MariaDB daemon with:"
echo "cd $basedir ; $bindir/mysqld_safe &" echo "cd '$basedir' ; '$bindir/mysqld_safe' &"
echo echo
echo "You can test the MariaDB daemon with mysql-test-run.pl" echo "You can test the MariaDB daemon with mysql-test-run.pl"
echo "cd $basedir/mysql-test ; perl mysql-test-run.pl" echo "cd '$basedir/mysql-test' ; perl mysql-test-run.pl"
fi fi
echo echo
echo "Please report any problems with the $scriptdir/mysqlbug script!" echo "Please report any problems with the '$scriptdir/mysqlbug' script!"
echo echo
echo "The latest information about MariaDB is available at http://www.askmonty.org/." echo "The latest information about MariaDB is available at http://www.askmonty.org/."
echo "You can find additional information about the MySQL part at:" echo "You can find additional information about the MySQL part at:"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment