Skip to content

Instantly share code, notes, and snippets.

@jakeasmith
Last active June 28, 2021 20:07
Show Gist options
  • Save jakeasmith/5701374 to your computer and use it in GitHub Desktop.
Save jakeasmith/5701374 to your computer and use it in GitHub Desktop.
A quick snippet for doing a compressed mysql dump with a pv to monitor progress
mysqldump [database] | pv | gzip -c > [file].sql.gz
@michaelglass
Copy link

michaelglass commented Jun 7, 2016

to connect without supplying your password in the command (don't do that!)

add a ~/.my.cnf with

[client]
user=username
password=password

OVEREXPLAIN$ chmod 600 ~/.my.cnf as always with sensitive files.

@mrvdot
Copy link

mrvdot commented Sep 19, 2016

You can also use pv -W to have it wait until transfer starts to begin reporting, allowing you to enter password via prompt

@stefkes
Copy link

stefkes commented Jun 24, 2018

the -W flag suggested by @mrvdot is required, otherwise the transfer will start without the password and effectively nothing will happen since there's no connection.

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