Created
July 5, 2011 16:24
-
-
Save carlosromero/1065173 to your computer and use it in GitHub Desktop.
Mysql dumps loader
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 | |
DBDUMP=$1 | |
USER=root | |
PASS= | |
DBNAME=mydb | |
DIRLOCAL=/home/user/dumps/ | |
cd $DIRLOCAL$DBDUMP | |
gzip -d *.gz | |
pwd | |
mysql -u $USER -p$PASS -D $DBNAME <<SQL | |
DROP DATABASE $DBNAME ; | |
SQL | |
mysqladmin -u $USER -p$PASS create $DBNAME | |
for tb in `ls *.sql` | |
do | |
# un archivo por tabla | |
mysql -u $USER -p$PASS $DBNAME < ${tb} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment