Last active
March 3, 2022 08:58
-
-
Save nilkesede/ef5597c8c9dd50ac9690177cb9ef61ac to your computer and use it in GitHub Desktop.
restore databases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
folder=$1 | |
for entry in `ls $folder` | |
do | |
database=${entry/.sql/} | |
echo "$database" | |
# docker exec -i mysql57 | |
mysql -uroot -proot -e "drop database if exists $database;create database $database" | |
mysql -uroot -proot $database < "$folder/$entry" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment