Skip to content

Instantly share code, notes, and snippets.

@mgirouard
Created April 7, 2013 21:52
Show Gist options
  • Save mgirouard/5332718 to your computer and use it in GitHub Desktop.
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
#!/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