前台的ssh隧道适用于mysql主机localhost和127.0.0.1,但后台的ssh隧道不起作用

yc0p9oo0  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(422)

所以这与我之前的问题类似,只是现在127.0.0.1也不起作用:前台的ssh tunnel适用于mysql主机localhost,而后台的ssh tunnel适用于mysql主机127.0.0.1

debug1: Authentication succeeded (publickey).
Authenticated to machine-two-hostname.com ([###.##.##.##]:22).
debug1: Local connections to LOCALHOST:3360 forwarded to remote address localhost:3360
debug3: channel_setup_fwd_listener_tcpip: type 2 wildcard 0 addr NULL
debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY
debug1: Local forwarding listening on ::1 port 3360.
debug2: fd 4 setting O_NONBLOCK
debug3: fd 4 is O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 3360.
debug2: fd 5 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 1: new [port listener]
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: forking to background
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0

它偶尔会“保持活力”,我认为这很正常:

debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug3: send packet: type 82
debug3: receive packet: type 80
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug3: send packet: type 82

我运行的命令是:

ssh -vvvvv -fN -L 3360:localhost:3360 admin@machine-two-hostname.com

所有通过后台ssh隧道的连接都被拒绝,但我可以通过前台隧道正常连接:

$ mysql -uroot -proot -h127.0.0.1
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111 "Connection refused")

更新:我使用的是mysql客户机这个答案可能是相关的:mysql error 2003(hy000)(113)in ssh remote tunnel,but telnet from ssh tunnel works

6qqygrtg

6qqygrtg1#

我使用的是端口3360,mysql在端口3306上。

相关问题