summaryrefslogtreecommitdiff
path: root/scripts/mysql_install_db.sh
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-06-09 17:07:11 +0200
committerunknown <guilhem@mysql.com>2004-06-09 17:07:11 +0200
commit57da23954ac08525ba926e2432ba99dd5fe57507 (patch)
treeadbbf8895f733fb48b69d48e981bfe18369b0bad /scripts/mysql_install_db.sh
parent84619e1352407ca86dc5c381b9b4731d75f80eac (diff)
downloadmariadb-git-57da23954ac08525ba926e2432ba99dd5fe57507.tar.gz
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.
Diffstat (limited to 'scripts/mysql_install_db.sh')
-rw-r--r--scripts/mysql_install_db.sh6
1 files changed, 5 insertions, 1 deletions
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