Skip to content

Instantly share code, notes, and snippets.

@vijinho
Created August 21, 2015 18:22
Show Gist options
  • Save vijinho/c068b5a88d752fdb0f71 to your computer and use it in GitHub Desktop.
Save vijinho/c068b5a88d752fdb0f71 to your computer and use it in GitHub Desktop.
dump a mysql database table
#/usr/local/bin/bash
DB=$2
HOST=$1
TABLE=$5
USER=$3
PASS=$4
MYSQLDUMP=$(which mysqldump)
MYSQLDUMP_OPTS=" --no-create-db --add-locks --add-drop-table --extended-insert --verbose"
$MYSQLDUMP $MYSQLDUMP_OPTS --host=$HOST --user=$USER --password=$PASS $DB $TABLE | bzip2 -c | cat > $2-$1.sql.bz2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment