Skip to content

Instantly share code, notes, and snippets.

@nilkesede
Last active March 3, 2022 08:58
Show Gist options
  • Save nilkesede/ef5597c8c9dd50ac9690177cb9ef61ac to your computer and use it in GitHub Desktop.
Save nilkesede/ef5597c8c9dd50ac9690177cb9ef61ac to your computer and use it in GitHub Desktop.
restore databases
#!/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