#!/bin/bash

# 转码
# sudo dos2unix import_macos.sh

# 授权可执行文件
# chmod +x import_macos.sh

# 将 .my.cnf 复制到 /User/mure 用户目录中
# 避免在命令行中直接输入密码

# 执行
# sh import_macos.sh

# MySQL 8.x 登录凭据
#username="root"
#password="123456"
database="backendsys"

# SQL文件所在的目录
sql_dir="/Users/mure/MyProject/QuickLaunchSpring/BackendSys/db/"

# 遍历目录中的所有.sql文件
for file in ${sql_dir}*.sql; do
  echo "Importing file: $file"
  /usr/local/mysql/bin/mysql $database < $file
#  /usr/local/mysql/bin/mysql -u $username -p$password $database < $file
done

echo "All SQL files have been imported."