Created
June 20, 2012 22:51
-
-
Save madlep/2962725 to your computer and use it in GitHub Desktop.
Script to import a gzipped mysql backup, piping it through pv to give progress status
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
#!/usr/bin/env bash | |
set -e | |
if [ "$#" == "0" ]; then | |
echo "Usage mysqldbimport MYSQLGZIPPEDBACKUPFILE [args to pass to mysql]" | |
echo "e.g. mysqldbimport mybackup.sql.gz -u root my_database_name" | |
fi | |
BACKUP_FILE="$1" | |
shift | |
MYSQL_ARGS="$@" | |
pv "$BACKUP_FILE" | gunzip -c | mysql $MYSQL_ARGS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment