Last active
June 28, 2021 20:07
-
-
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
This file contains 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
mysqldump [database] | pv | gzip -c > [file].sql.gz |
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.
You can also use pv -W
to have it wait until transfer starts to begin reporting, allowing you to enter password via prompt
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
Note that PV will begin immediately so you must supply your mysql password in the command as the prompt won't work