caijinlin
5/18/2018 - 6:35 AM

导入mysql数据库shell脚本

导入mysql数据库shell脚本

```
#!/usr/bin/env bash

user=$1
password=$2

declare -a dbs=("test1" "test2")

for db in "${dbs[@]}"
do
	db="db_$db"
	echo "初始化 $db"
	mysql -u$user -p$password -e "drop database if exists $db;create database $db;use $db;source ./sql/$db.sql;"
done

```