Skip to content

Instantly share code, notes, and snippets.

@januszm
Last active July 23, 2021 14:28
Show Gist options
  • Save januszm/df15ae855e210d09e87acd8820beea1a to your computer and use it in GitHub Desktop.
Save januszm/df15ae855e210d09e87acd8820beea1a to your computer and use it in GitHub Desktop.
#!/bin/bash
# -d for no data, just structure
# -t for no create, just data
# --ignore-table=name1 --ignore-table=name2
# --skip-comments
# include table names after DATABASE
mysqldump -u USER -h HOST -p DATABASE | gzip > DATABASE.sql.gz
# load
zcat DATABASE.sql.gz | mysql -u USER -p DATABASE
# or
gunzip < DATABASE.sql.gz | mysql -u USER -p DATABASE
# or with progressbar
pv DATABASE.sql.gz | gunzip | mysql -u USER -p DATABASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment