Skip to content

Instantly share code, notes, and snippets.

@carltondickson
Last active March 26, 2023 15:18
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save carltondickson/b14d72d9d3631f870c48 to your computer and use it in GitHub Desktop.
Save carltondickson/b14d72d9d3631f870c48 to your computer and use it in GitHub Desktop.
mysqldump export and zip
# Exporting entire database:
mysqldump -u user -p database --opt | gzip > database.sql.gz
# Export table
mysqldump -uroot --opt --databases DB_NAME --tables TABLE_NAME | gzip > /tmp/TABLE_NAME.export.sql.gz
# Importing:
gunzip < database.sql.gz | mysql -u user -p database
# Credit http://failshell.io/mysql/using-gzip-and-gunzip-with-mysql-to-importexport-backups/
@uacode
Copy link

uacode commented Oct 27, 2020

--skip-lock-tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment