Source

iredmail / iRedMail / functions / mysql.sh

Diff from to

File iRedMail/functions/mysql.sh

 # -------------------------------------------------------
 # -------------------- MySQL ----------------------------
 # -------------------------------------------------------
+mysql_generate_defauts_file_root()
+{
+    ECHO_DEBUG "Generate temporary defauts file for MySQL client option --defaults-file: ${MYSQL_DEFAULTS_FILE_ROOT}."
+    cat >> ${MYSQL_DEFAULTS_FILE_ROOT} <<EOF
+[client]
+host=${MYSQL_SERVER}
+port=${MYSQL_SERVER_PORT}
+user=${MYSQL_ROOT_USER}
+password=${MYSQL_ROOT_PASSWD}
+EOF
+}
+
 mysql_initialize()
 {
-    ECHO_INFO "Configure MySQL database server." 
-
     ECHO_DEBUG "Starting MySQL."
 
     # Initial MySQL database first
     ECHO_DEBUG "Sleep 5 seconds for MySQL daemon initialize ..."
     sleep 5
 
-    # Generate temporary file for MySQL client option --defaults-file.
-    cat >> ${MYSQL_DEFAULTS_FILE_ROOT} <<EOF
-[client]
-host=${MYSQL_SERVER}
-port=${MYSQL_SERVER_PORT}
-user=${MYSQL_ROOT_USER}
-password=${MYSQL_ROOT_PASSWD}
-EOF
-
     if [ X"${LOCAL_ADDRESS}" == X'127.0.0.1' ]; then
         # Try to access without password, set a password if it's empty.
         mysql -u${MYSQL_ROOT_USER} -e "show databases" &>/dev/null