前台的 ssh 隧道适用于 mysql host localhost 和 127.0.0.1 但后台的 ssh-tunnel 不起作用

ssh tunnel in foreground works for mysql host localhost and 127.0.0.1 but ssh-tunnel in background doesn't work

所以这与我之前的问题类似,除了现在 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

我正在使用端口 3360 MySQL 在端口 3306 上。