通过跳板机SSH连接mysql
import pymysql
import pandas as pd
from sshtunnel import SSHtunnelForwarder
with SSHtunnelForwarder
#配置ssh连接
ssh_address_or_host=('192.168.0.36', int('3000')), # 指定ssh登录的跳转机的address
ssh_username="用户名" # 跳转机用户
ssh_password="密码" # 跳转机密码
loacl_bind_address=('127.0.0.1', int('2222')) # 地址必须 127.0.0.1
remote_bing_address=('mysql服务器地址', int('端口号')) as server # MySQL服务器的配置
conn = pymysql.connect(host='127.0.0.1', post='2222',user='mysql服务器用户名', password='mysql服务器密码')
cursor = conn.cursor()