Last active
December 23, 2015 20:59
-
-
Save rosenhouse/6693251 to your computer and use it in GitHub Desktop.
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
echo "Connecting to bastion via SSH..." | |
ssh -nNf bastion | |
echo "Connecting to MySQL..." | |
mysql -ugabe -pPaS$w0rD -h127.0.0.1 my_database | |
echo "MySQL client terminated, closing SSH connection..." | |
ssh -O exit bastion | |
echo "Done." |
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
# put this in ~/.ssh/config | |
Host bastion | |
HostName bastion.example.com | |
IdentityFile ~/.ssh/my-private-key | |
LocalForward 3306 db-server.local:3306 | |
User gabe | |
ControlMaster auto | |
ControlPath /tmp/ssh-%r@%h:%p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment