From 7a00d199a4bc83f9e3d940003c6c0f6c117d9650 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jun 2004 17:07:11 +0200 Subject: Fix for BUG#4038 "rpm postinstall script leaves files as owned by root": the rpm postinstall script must call mysql_install_db with --user=mysql, and mysql_install_db must then pass this to mysqld. Otherwise, mysqld runs as root, and if you have --log-bin=somewhere_out_of_var_lib_mysql it creates binlog files owned by root in this dir, and this dir is not fixed by the 'chmod mysql', so files remain owned by root, and later mysqld (running as 'mysql') can't read them. I'm hardcoding 'mysql' in the postinstall script, but it's already hardcoded there in many places (see the useradd and chown) so it's ok. scripts/mysql_install_db.sh: Pass --user to mysqld support-files/mysql.spec.sh: in postinstall, call mysql_install_db with --user=mysql, so that mysqld (which installs the grant tables) is started with --user=mysql. --- scripts/mysql_install_db.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index c03049c6a91..931c8f21a92 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -38,6 +38,9 @@ parse_arguments() { --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; + # Note that this will be passed to mysqld so that it runs + # as 'user' (crucial e.g. if log-bin=/some_other_path/ + # where a chown of datadir won't help) --skip-name-resolve) ip_only=1 ;; --verbose) verbose=1 ;; --rpm) in_rpm=1 ;; @@ -332,7 +335,8 @@ fi echo "Installing all prepared tables" if eval "$mysqld $defaults $mysqld_opt --bootstrap --skip-grant-tables \ - --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" << END_OF_DATA + --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \ + --user=$user $args" << END_OF_DATA use mysql; $c_d $i_d -- cgit v1.2.1 From 93290dad1ff132ede9e80afe956e7b5b5d6fed25 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jun 2004 13:56:58 +0200 Subject: warn about multiple mysqld --user parameters only if their arguments differ scripts/mysqld_safe.sh: don't protect mysqld from multiple --user commands - mysqld can take care of itself sql/mysqld.cc: warn about multiple --user parameters only if their arguments differ --- scripts/mysqld_safe.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 779438e75c3..7b77bf449cd 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -43,13 +43,7 @@ parse_arguments() { --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;; --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;; - --user=*) - if test $SET_USER -eq 0 - then - user=`echo "$arg" | sed -e "s;--[^=]*=;;"` - fi - SET_USER=1 - ;; + --user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;; # these two might have been set in a [mysqld_safe] section of my.cnf # they are added to mysqld command line to override settings from my.cnf -- cgit v1.2.1 From 43f0418d330656667420398a2bd14c3ac42b3617 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jun 2004 16:44:39 +0300 Subject: After merge fix scripts/mysql_install_db.sh: Cleanup --- scripts/mysql_install_db.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 931c8f21a92..600a87328cb 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -37,10 +37,11 @@ parse_arguments() { --force) force=1 ;; --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; - --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; - # Note that this will be passed to mysqld so that it runs - # as 'user' (crucial e.g. if log-bin=/some_other_path/ - # where a chown of datadir won't help) + --user=*) + # Note that the user will be passed to mysqld so that it runs + # as 'user' (crucial e.g. if log-bin=/some_other_path/ + # where a chown of datadir won't help) + user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --skip-name-resolve) ip_only=1 ;; --verbose) verbose=1 ;; --rpm) in_rpm=1 ;; -- cgit v1.2.1 From 5fa063ba7eda4bbe70e758b2e5662dbd4edfe961 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jun 2004 04:22:43 +0300 Subject: ke it possible to use mysys functions in netware/mysql_test_run.c Don't pass --user to mysqld if --user is not used netware/Makefile.am: Make it possible to use mysys functions in mysql_test_run.c netware/mysql_test_run.c: Make it possible to use mysys functions in mysql_test_run.c scripts/mysql_install_db.sh: Don't pass --user to mysqld if --user is not used --- scripts/mysql_install_db.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 600a87328cb..c6e9f04fa91 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -10,6 +10,7 @@ in_rpm=0 windows=0 defaults="" +user="" case "$1" in -IN-RPM) in_rpm="1"; shift @@ -334,10 +335,14 @@ then c_c="$c_c comment='Column privileges';" fi +if test -n "$user"; then + args="$args --user=$user" +fi + echo "Installing all prepared tables" if eval "$mysqld $defaults $mysqld_opt --bootstrap --skip-grant-tables \ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \ - --user=$user $args" << END_OF_DATA + $extra_arg $args" << END_OF_DATA use mysql; $c_d $i_d -- cgit v1.2.1