Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # We use this method due to not all MySQL client able to connect via it's SSH Tunnel feature
- # It depends on SSH library they used
- if [ "x$1" = "x" ]; then
- echo "Usage:"
- echo "$0 <serveraddress>"
- echo "or"
- echo "$0 <username@serveraddress>"
- fi
- # Steps:
- # 1. Open ssh connection to server and forward port 3306 on server to 3307 on localhost
- ssh $1 -t -L 3307:localhost:3306 2> /dev/null
- #2. Open your mysql client then create connection with these params:
- # - host : localhost
- # - port : 3307
- # - username : <your database username>
- # - password : <your database password>
- #3. Connect!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement