#!/bin/bash

# 导出脚本
#
SQL_DUMP_FILE=/root/all_tables_4.1.0.sql
/root/wdd/mysql/bin/mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 -e 'show databases;' | grep -Ev 'Database|information_schema|mysql|sys|performance_schema' | xargs /root/wdd/mysql/bin/mysqldump -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 --single-transaction  --source-data=2 --hex-blob --triggers --routines --events --no-data --set-gtid-purged=OFF --databases  > "${SQL_DUMP_FILE}"


SQL_FULL_BACK_UP_FILE=/home/mmc/all_tables_4.0.2_230914_fullback.sql
/root/wdd/mysql/bin/mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 -e 'show databases;' | grep -Ev 'Database|information_schema|mysql|sys|performance_schema' | xargs /root/wdd/mysql/bin/mysqldump -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 --single-transaction  --source-data=2 --hex-blob --triggers --routines --events --set-gtid-purged=OFF --databases  > "${SQL_FULL_BACK_UP_FILE}"





# 导入脚本
export sql_import_file_path="/root/wdd/database"
for sql_file in $(ls "$sql_import_file_path" | sort -n -k1.1,1.2); do
    echo "current file is ${sql_file}"

    /root/mysql-8.0.27-linux-glibc2.17-x86_64-minimal/bin/mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 <"$sql_import_file_path/${sql_file}"

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


#
/root/wdd/mysql/bin/mysql -uroot -pQzfXQhd3bQ -h10.250.0.110 -P33306

/root/wdd/mysql/bin/mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 < /root/123.sql


apt install libncurses5
yum install ncurses-compat-libs.x86_64

wget https://oss.demo.uavcmlc.com/cmlc-installation/downloadfile/amd/mysql-8.0.27-linux-glibc2.17-x86_64-minimal.zip

wget https://oss.demo.uavcmlc.com/cmlc-installation/downloadfile/amd/mysql-8.0.27-linux-glibc2.17-x86_64-minimal.tar.gz


