summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-09-02 20:42:07 +0300
committermonty@hundin.mysql.fi <>2001-09-02 20:42:07 +0300
commit7f8f1bd9797e64c700112bf658cea3fa87e129ad (patch)
tree5347a76b780d3917bc986c866ced057e7783b9d6 /scripts
parent759cf54a9e70013d92fe18a84b3e4c56244de7da (diff)
downloadmariadb-git-7f8f1bd9797e64c700112bf658cea3fa87e129ad.tar.gz
Fix to not running mysqld as root by default
Diffstat (limited to 'scripts')
-rw-r--r--scripts/safe_mysqld.sh8
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"