Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # We use this method due to not all MySQL client able to connect via it's SSH Tunnel feature
  4. # It depends on SSH library they used
  5.  
  6. if [ "x$1" = "x" ]; then
  7. echo "Usage:"
  8. echo "$0 <serveraddress>"
  9. echo "or"
  10. echo "$0 <username@serveraddress>"
  11. fi
  12.  
  13.  
  14. # Steps:
  15. # 1. Open ssh connection to server and forward port 3306 on server to 3307 on localhost
  16. ssh $1 -t -L 3307:localhost:3306 2> /dev/null
  17.  
  18. #2. Open your mysql client then create connection with these params:
  19. # - host : localhost
  20. # - port : 3307
  21. # - username : <your database username>
  22. # - password : <your database password>
  23.  
  24. #3. Connect!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement