Skip to content

Instantly share code, notes, and snippets.

@adeolaawoyemi
Created July 3, 2012 16:18
Show Gist options
  • Save adeolaawoyemi/3040782 to your computer and use it in GitHub Desktop.
Save adeolaawoyemi/3040782 to your computer and use it in GitHub Desktop.
Batch-import databases
for d in *.sql; do echo "Database ${d/.sql/} will be created" && mysql -uroot -e "create database ${d/.sql/};" && mysql -uroot ${d/.sql/} < $d && echo "Done creating and populating ${d/.sql/}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment