Commit eb7dc667 authored by unknown's avatar unknown

make mysqld to respect socket/port options of mysqld_safe command line

and [mysqld_safe] section in my.cnf, even if they are also specified
in [mysql] section.

parent bfe957bf
...@@ -51,9 +51,9 @@ parse_arguments() { ...@@ -51,9 +51,9 @@ parse_arguments() {
;; ;;
# these two might have been set in a [mysqld_safe] section of my.cnf # these two might have been set in a [mysqld_safe] section of my.cnf
# they get passed via environment variables to mysqld_safe # they are added to mysqld command line to override settings from my.cnf
--socket=*) MYSQL_UNIX_PORT=`echo "$arg" | sed -e "s;--socket=;;"` ;; --socket=*) mysql_unix_port=`echo "$arg" | sed -e "s;--socket=;;"` ;;
--port=*) MYSQL_TCP_PORT=`echo "$arg" | sed -e "s;--port=;;"` ;; --port=*) mysql_tcp_port=`echo "$arg" | sed -e "s;--port=;;"` ;;
# mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])! # mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
--ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;; --ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;;
...@@ -114,8 +114,7 @@ else ...@@ -114,8 +114,7 @@ else
ledir=@libexecdir@ ledir=@libexecdir@
fi fi
MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@} safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@}
user=@MYSQLD_USER@ user=@MYSQLD_USER@
niceness=0 niceness=0
...@@ -171,9 +170,14 @@ else ...@@ -171,9 +170,14 @@ else
fi fi
test -z "$err_log" && err_log=$DATADIR/`@HOSTNAME@`.err test -z "$err_log" && err_log=$DATADIR/`@HOSTNAME@`.err
export MYSQL_UNIX_PORT if test -n "$mysql_unix_port"
export MYSQL_TCP_PORT then
args="--socket=$mysql_unix_port $args"
fi
if test -n "$mysql_tcp_port"
then
args="--port=$mysql_tcp_port $args"
fi
if test $niceness -eq 0 if test $niceness -eq 0
then then
...@@ -296,7 +300,7 @@ echo "Starting $MYSQLD daemon with databases from $DATADIR" ...@@ -296,7 +300,7 @@ echo "Starting $MYSQLD daemon with databases from $DATADIR"
echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log
while true while true
do do
rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety rm -f $safe_mysql_unix_port $pid_file # Some extra safety
if test -z "$args" if test -z "$args"
then then
$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1 $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
......
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