#!/bin/bash

need_to_import_sql_folder="/home/wdd/Documents/master_data_5.2.0"
target_host_ip=20.4.13.81
target_host_port=33306
target_user=root
target_passwd=QzfXQhd3bQ


full_back_up_database(){
    echo "yes"
}


batch_import_sql_struct_to_server(){

    for sql_file in $(ls ${need_to_import_sql_folder} | sort -n); do
        if [ -d $need_to_import_sql_folder/${sql_file} ];then
            continue
        fi

        echo "current file is $need_to_import_sql_folder/${sql_file}"

        /root/wdd/mysql/bin/mysql -u${target_user} -p${target_passwd} -h${target_host_ip} -P${target_host_port} <"$need_to_import_sql_folder/${sql_file}"

        echo "------------------"
        echo ""
    done
}

batch_import_sql_struct_to_server


