install_mysql.sh: fix error in creating maintance MySQL User in case of MariaDB

This commit is contained in:
Christoph 2018-12-10 03:25:21 +01:00
parent 3786abea87
commit b358031075

View File

@ -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