Skip to content

Instantly share code, notes, and snippets.

@mshmsh5000
Created May 28, 2014 14:59
Show Gist options
  • Save mshmsh5000/17b1deab05bcfaafc4ad to your computer and use it in GitHub Desktop.
Save mshmsh5000/17b1deab05bcfaafc4ad to your computer and use it in GitHub Desktop.
Import SQL from nightly dump
#!/usr/bin/env bash
# Create the MySQL tables
for file in *.sql
do
echo $file
cat $file | mysql -u USER -pPASS DBNAME
cat $file | mysql -u USER -pPASS DBNAME
done
# Import the data
for data in *.txt
do
mysqlimport -u USER -pPASS --local DBNAME $data
mysqlimport -u USER -pPASS --local DBNAME $data
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment