diff options
Diffstat (limited to 'kubernetes/common/mariadb-init/resources/config/db_init.sh')
-rwxr-xr-x | kubernetes/common/mariadb-init/resources/config/db_init.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kubernetes/common/mariadb-init/resources/config/db_init.sh b/kubernetes/common/mariadb-init/resources/config/db_init.sh index df7c336405..8f7e7ce44b 100755 --- a/kubernetes/common/mariadb-init/resources/config/db_init.sh +++ b/kubernetes/common/mariadb-init/resources/config/db_init.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh {{/* # Copyright © 2019 Orange @@ -32,13 +32,13 @@ while read DB ; do */}} eval USER=\$$USER_VAR PASS=$(eval echo -n \$$PASS_VAR | sed -e "s/'/''/g") - MYSQL_OPTS=( -h ${DB_HOST} -P ${DB_PORT} -uroot -p${MYSQL_ROOT_PASSWORD} ) + MYSQL_OPTS=" -h "${DB_HOST}" -P "${DB_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD} echo "Creating database ${DB} and user ${USER}..." - mysql "${MYSQL_OPTS[@]}" -e "CREATE OR REPLACE USER '${USER}'@'%' IDENTIFIED BY '${PASS}'" - mysql "${MYSQL_OPTS[@]}" -e "CREATE DATABASE IF NOT EXISTS ${DB}" - mysql "${MYSQL_OPTS[@]}" -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'%'" + mysql $MYSQL_OPTS -e "CREATE OR REPLACE USER '${USER}'@'%' IDENTIFIED BY '${PASS}'" + mysql $MYSQL_OPTS -e "CREATE DATABASE IF NOT EXISTS ${DB}" + mysql $MYSQL_OPTS -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'%'" echo "Created database ${DB} and user ${USER}." done <<EOF |