推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
daiqiangbudainiu
V2EX  ›  Python

pymysql 怎么连接需要通过 ssh 跳转的数据库呢

  •  
  •   daiqiangbudainiu · Oct 31, 2017 · 3903 views
    This topic created in 3264 days ago, the information mentioned may be changed or developed.

    MySQL 的数据库所在的服务器需要通过一个跳板机才能连接

    像 Sequel Pro 这种软件可以提供这样的功能,但是我现在想用 Python 脚本做一些事情,需要登录数据库,查了一下 pymysql 的方法,好像没看到有这样的支持

    不知道有没有什么办法

    5 replies  •  2017-10-31 11:40:13 +08:00
    okletswin
        1
    okletswin  
       Oct 31, 2017
    很简单
    打开 google (bing 和 baidu 未测试)
    输入关键字 python mysql ssh
    点击搜索
    wangking
        2
    wangking  
       Oct 31, 2017
    跳板机的话 你做一个 ssh 隧道不行吗
    RuiQ
        3
    RuiQ  
       Oct 31, 2017
    import sshtunnel
    congeec
        4
    congeec  
       Oct 31, 2017
    不需要加密: socat 直接转发
    需要加密:搜 ssh forwarding
    这些工具跟 mysql 无关,有 IP 和端口就行
    q397064399
        5
    q397064399  
       Oct 31, 2017
    ssh 转发到本地
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   989 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:54 · PVG 02:54 · LAX 11:54 · JFK 14:54
    ♥ Do have faith in what you're doing.