From b35803107583148dd694618a9ddb5ca0f07f96c9 Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 10 Dec 2018 03:25:21 +0100 Subject: [PATCH] install_mysql.sh: fix error in creating maintance MySQL User in case of MariaDB --- install_mysql.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/install_mysql.sh b/install_mysql.sh index 1b08f9d..d560300 100755 --- a/install_mysql.sh +++ b/install_mysql.sh @@ -5237,7 +5237,53 @@ if ! $UPDATE_MYSQL || $_sys_maint_cnf_needed ; then _maint_user=sys-maint - if [[ "$MYSQL_MAJOR_VERSION" -lt 8 ]]; then + if [[ "$MYSQL_DISTRIBUTION" = "MariaDB" ]]; then + + echononl "Erstelle maintance MySQL User '${_maint_user}' - localhost.." + echo "" >> ${logdir}/main.log + echo "## - Erstelle maintance MySQL User '${_maint_user}' - localhost" >> ${logdir}/main.log + echo "" >> ${logdir}/main.log + echo "${MYSQL_INSTALL_DIR}/bin/mysql -uroot -p$MYSQL_ROOT_PW mysql -N -s -e \"CREATE USER '${_maint_user}'@'localhost' IDENTIFIED BY '$_maint_passwd'\"" >> ${logdir}/main.log + ${MYSQL_INSTALL_DIR}/bin/mysql -uroot -p$MYSQL_ROOT_PW mysql -N -s -e "CREATE USER '${_maint_user}'@'localhost' IDENTIFIED BY '$_maint_passwd'" >> ${logdir}/main.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + error Konnte \(MySQL\) User \"${_maint_user}\" nicht erstellen.. + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/nno]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" + fi + + echononl "Set (all) privileges to MySQL User '${_maint_user}' - localhost.." + echo "" >> ${logdir}/main.log + echo "## - Set (all) privileges to MySQL User '${_maint_user}' - localhost" >> ${logdir}/main.log + echo "" >> ${logdir}/main.log + echo "${MYSQL_INSTALL_DIR}/bin/mysql -uroot -p$MYSQL_ROOT_PW mysql -N -s -e \"GRANT ALL ON *.* TO '${_maint_user}'@'localhost'\"" >> ${logdir}/main.log + ${MYSQL_INSTALL_DIR}/bin/mysql -uroot -p$MYSQL_ROOT_PW mysql -N -s -e "GRANT ALL ON *.* TO '${_maint_user}'@'localhost'" >> ${logdir}/main.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + error Konnte \(MySQL\) User \"${_maint_user}\" nicht erstellen.. + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/nno]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" + fi + + elif [[ "$MYSQL_MAJOR_VERSION" -lt 8 ]]; then echononl "Erstelle maintance MySQL User '${_maint_user}' - localhost.." echo "" >> ${logdir}/main.log