[CLAMP,COMMON] Escape special chars in mysql passwords
[oom.git] / kubernetes / common / mariadb-galera / resources / config / configure-mysql.sh
index 42c5c89..6787617 100755 (executable)
@@ -32,8 +32,9 @@ if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then
        mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql
 fi
 
-function prepare_password {
-       echo -n $1 | sed -e "s/'/''/g"
+prepare_password()
+{
+       echo "$1" | sed -e "s/'/\\\\'/g; s/\"/\\\\\"/g"
 }
 
 mysql_root_password=`prepare_password $MYSQL_ROOT_PASSWORD`