Commit 3e7a5763 authored by unknown's avatar unknown

Fix handling of datadir by mysqld_safe to support specifying a

different DATADIR via the command line or during ./configure and
still starting up mysqld_safe via a relative path. (Bug #7249)


scripts/mysqld_safe.sh:
  Decouple figuring out which BASEDIR and DATADIR to use so that
  the only DATADIR we'll try to use without first verifying that
  it exists is the compiled-in default.
parent a7e66efc
...@@ -84,31 +84,49 @@ parse_arguments() { ...@@ -84,31 +84,49 @@ parse_arguments() {
} }
#
# First, try to find BASEDIR and ledir (where mysqld is)
#
MY_PWD=`pwd` MY_PWD=`pwd`
# Check if we are starting this relative (for the binary release) # Check for the directories we would expect from a binary release install
if test -f ./share/mysql/english/errmsg.sys -a \ if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld
-x ./bin/mysqld
then then
MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is
DATADIR=$MY_BASEDIR_VERSION/data # Check for the directories we would expect from a source install
if test -z "$defaults"
then
defaults="--defaults-extra-file=$MY_BASEDIR_VERSION/data/my.cnf"
fi
# Check if this is a 'moved install directory'
elif test -f ./share/mysql/english/errmsg.sys -a \ elif test -f ./share/mysql/english/errmsg.sys -a \
-x ./libexec/mysqld -x ./libexec/mysqld
then then
MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are
ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is
DATADIR=$MY_BASEDIR_VERSION/var # Since we didn't find anything, used the compiled-in defaults
else else
MY_BASEDIR_VERSION=@prefix@ MY_BASEDIR_VERSION=@prefix@
DATADIR=@localstatedir@
ledir=@libexecdir@ ledir=@libexecdir@
fi fi
#
# Second, try to find the data directory
#
# Try where the binary installs put it
if test -d $MY_BASEDIR_VERSION/data/mysql
then
DATADIR=$MY_BASEDIR_VERSION/data
if test -z "$defaults"
then
defaults="--defaults-extra-file=$DATADIR/my.cnf"
fi
# Next try where the source installs put it
elif test -d $MY_BASEDIR_VERSION/var/mysql
then
DATADIR=$MY_BASEDIR_VERSION/var
# Or just give up and use our compiled-in default
else
DATADIR=@localstatedir@
fi
user=@MYSQLD_USER@ user=@MYSQLD_USER@
niceness=0 niceness=0
......
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