Blob Blame History Raw
diff --git a/scripts/dbscripts/upgrade/DPM_upgrade_mysql b/scripts/dbscripts/upgrade/DPM_upgrade_mysql
index 192a014f..7f8ea868 100755
--- a/scripts/dbscripts/upgrade/DPM_upgrade_mysql
+++ b/scripts/dbscripts/upgrade/DPM_upgrade_mysql
@@ -190,10 +190,35 @@ function parse_config_host () {
   if [ $? -eq 0 ]; then
     ret=$(echo "${ret}" | sed 's|/.*||')
   fi
-  if [ "${ret}" != "" ]; then
-    echo "${ret}"
+  if [ "${ret}" == "" ]; then
+    echo "${DEFAULT}"
   else
+    echo "${ret}" | grep -q ':'
+    if [ $? -eq 0 ]; then
+      ret=$(echo "${ret}" | sed 's|:.*||')
+    else
+      echo "${DEFAULT}"
+    fi
+  fi
+}
+
+function parse_config_port () {
+  CONFIG_FILE=$1
+  DEFAULT=$2
+  ret=$(head -n 1 "${CONFIG_FILE}" 2> /dev/null | sed 's|.*@||')
+  echo "${ret}" | grep -q '/'
+  if [ $? -eq 0 ]; then
+    ret=$(echo "${ret}" | sed 's|/.*||')
+  fi
+  if [ "${ret}" == "" ]; then
     echo "${DEFAULT}"
+  else
+    echo "${ret}" | grep -q ':'
+    if [ $? -eq 0 ]; then
+      ret=$(echo "${ret}" | sed 's|.*:||')
+    else
+      echo "${DEFAULT}"
+    fi
   fi
 }