diff options
Diffstat (limited to 'scripts/safe_mysqld.sh')
-rw-r--r-- | scripts/safe_mysqld.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index 59d7dcc5cfc..e7418819604 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -31,7 +31,7 @@ parse_arguments() { --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;; --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;; - --user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;; + --user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;; # these two might have been set in a [safe_mysqld] section of my.cnf # they get passed via environment variables to safe_mysqld @@ -108,6 +108,7 @@ fi # these rely on $DATADIR by default, so we'll set them later on pid_file= err_log= +SET_USER=0 # Get first arguments from the my.cnf file, groups [mysqld] and [safe_mysqld] # and then merge with the command line arguments @@ -167,7 +168,10 @@ fi USER_OPTION="" if test -w / then - USER_OPTION="--user=$user" + if test "$user" != "root" -o $SET_USER = 1 + then + USER_OPTION="--user=$user" + fi # If we are root, change the err log to the right user. touch $err_log; chown $user $err_log if test -n "$open_files" |