Created
July 6, 2022 16:53
-
-
Save altherlex/84691ed157364c4c95887db52c47319c to your computer and use it in GitHub Desktop.
Dump mysql via tunnel
This file contains hidden or 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
# Create tunnel gateway | |
$ ssh -L 3306:staging-bastion:3306 tunnel@staging-bastion | |
# Check the port | |
$ nc -z localhost 3306 | |
# Dump via tunnel | |
$ mysqldump -P 3306 -ualther -p '9E@EeM#C)(Ip$n%9Cy6EIr}QyD!ZbFd' staging_myhi > staging_myhi.sql -h staging-myhi.csqfg2d4yaps.ca-central-1.rds.amazonaws.co | |
# - with gzip | |
$ mysqldump -P 3306 -ualther -p '9E@EeM#C)(Ip$n%9Cy6EIr}QyD!ZbFd' -h staging-myhi.csqfg2d4yaps.ca-central-1.rds.amazonaws.com staging_myhi | gzip > stage-myhi.sql.gz | |
# Execute command via tunnel | |
$ ssh tunnel@staging-bastion mysqldump -u alther -p=9E@EeM#C)(Ip$n%9Cy6EIr}QyD!ZbFd staging_myhi | gzip > staging_myhi.sql.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment