Skip to content

Instantly share code, notes, and snippets.

@Swader
Created March 15, 2013 22:09
Show Gist options
  • Save Swader/5173460 to your computer and use it in GitHub Desktop.
Save Swader/5173460 to your computer and use it in GitHub Desktop.
How to import multiple SQL files for separate databases at once from terminal, if those files are named after the database (with an optional prefix / suffix). Just alias it, and change the file format for your own. Taken from http://stackoverflow.com/questions/4708013/import-multiple-sql-dump-files-into-mysql-database-from-shell/12481305
for SQL in *.sql; do DB=${SQL/\.sql/}; echo importing $DB; mysql $DB < $SQL; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment