Created
April 7, 2013 21:52
-
-
Save mgirouard/5332718 to your computer and use it in GitHub Desktop.
One-liner to quickly set up a MySQL DB and import data from a given file
This file contains hidden or 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 | |
# | |
# $U = DB User | |
# $N = DB Name | |
# | |
mysql -u $U -p <<< "CREATE DATABASE $D DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; use $D; source data/$D.sql;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment