summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2012-09-14 18:34:36 +0200
committerRemi Collet <fedora@famillecollet.com>2012-09-14 18:34:36 +0200
commita1ed7cf0f44da7ec8d28dd5bb95acd5ee34e0111 (patch)
treeaaa8463909fe717fe33015b02790c2524327ea76
parente5c92796f54858e607f887731506c89c6e3f8be0 (diff)
mysql 5.4: sync with rawhide
-rw-r--r--mysqld-prepare-db-dir9
1 files changed, 8 insertions, 1 deletions
diff --git a/mysqld-prepare-db-dir b/mysqld-prepare-db-dir
index 72badd7..78c0bd7 100644
--- a/mysqld-prepare-db-dir
+++ b/mysqld-prepare-db-dir
@@ -45,10 +45,17 @@ if [ ! -d "$datadir/mysql" ] ; then
echo "Initializing MySQL database"
/usr/bin/mysql_install_db --datadir="$datadir" --user=mysql
ret=$?
- chown -R mysql:mysql "$datadir"
if [ $ret -ne 0 ] ; then
+ echo "Initialization of MySQL database failed." >&2
+ echo "Perhaps /etc/my.cnf is misconfigured." >&2
+ # Clean up any partially-created database files
+ if [ ! -e "$datadir/mysql/user.frm" ] ; then
+ rm -rf "$datadir"/*
+ fi
exit $ret
fi
+ # In case we're running as root, make sure files are owned properly
+ chown -R mysql:mysql "$datadir"
fi
exit 0