qweweretrt515
V2EX  ›  问与答

如何用服务器中转另外一个服务器上的端口到本地?

  •  
  •   qweweretrt515 · Sep 30, 2016 · 3035 views
    This topic created in 3604 days ago, the information mentioned may be changed or developed.

    web 服务器: unbuntu
    我的电脑: win10 远程数据库: mysql

    这 3 个环境, ip 都不一样,不在同一个网络

    我想实现,访问本地的 3306 端口,就相当于访问 远程数据库的 3306 端口

    以前有个命令: ssh -L 3306:mysql.com:3306  [email protected]

    可以实现,把数据库的端口映射到本地,但是好像现在用不了了

    现在想请教各位大神,有办法吗? 最好是一条系统自带的命令可以搞定 ,那就最好了

    Supplement 1  ·  Sep 30, 2016
    因为我本地,无法直接访问数据库,数据库和我是隔离的,我只能访问 web 服务器
    Supplement 2  ·  Oct 1, 2016
    2 replies    2016-10-01 18:55:33 +08:00
    nyaruko
        1
    nyaruko  
       Oct 1, 2016   ❤️ 1
    ssh -C -f -N -L 3306:mysql.com:3306 [email protected] 试试呢?不过要确认下 web.com 主机上的 3306 端口是不是可用。。。或者你可以试试 mysql proxy
    qweweretrt515
        2
    qweweretrt515  
    OP
       Oct 1, 2016
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3124 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:14 · PVG 22:14 · LAX 07:14 · JFK 10:14
    ♥ Do have faith in what you're doing.