【问题标题】:ssh tunnel in foreground works for mysql host localhost and 127.0.0.1 but ssh-tunnel in background doesn't work前台的 ssh 隧道适用于 mysql 主机 localhost 和 127.0.0.1,但后台的 ssh-tunnel 不起作用
【发布时间】:2018-11-30 04:50:11
【问题描述】:

所以这类似于我之前的问题,除了现在 127.0.0.1 也不起作用:ssh tunnel in foreground works for mysql host localhost but ssh-tunnel in background works for mysql host 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

它偶尔会“keepalive”,我认为这是正常的:

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-client 这个答案可能是相关的: MYSQL ERROR 2003 (HY000) (113) in SSH remote tunneling, but telnet from SSH tunnel works

【问题讨论】:

    标签: mysql ssh ssh-tunnel


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-20
      • 2017-12-18
      • 1970-01-01
      • 2017-06-01
      • 1970-01-01
      • 2019-08-07
      相关资源
      最近更新 更多