使用ssh隧道(通过跳板机)连接mysql

2018-03-06  本文已影响0人  yanshaowen

1 window系统使用前提:

需要安装ssh命令(两种安装方法任选一)
1.1 安装openssh
1.2 gitbash 客户端

2 创建ssh映射

打开cmd(或者gitbash界面)执行:

ssh -p {ssh_port} -i {rsa_file} -fNL {local_port}:{mysql_ip}:{mysql_port} 
{ssh_user}@{ssh_ip}
ssh -p 22  -i ./id_rsa_jump -fNL 33060:mysql_ip:3306 jump@jump_ip   # 实例

检查是否启动成功

netstat  -aon|findstr  "33060"  #存在对应的监听则启动成功 如果要关闭则kill

连接mysql

ip:127.0.0.1
port:33060
....
上一篇 下一篇

猜你喜欢

热点阅读