上传者: 38696836
|
上传时间: 2021-12-21 17:33:03
|
文件大小: 43KB
|
文件类型: -
我就废话不多说了,大家还是直接看代码吧~
import pymysql
from sshtunnel import SSHTunnelForwarder
import pymysql.cursors #以dict形式输出
def dbconnect_ssh(ssh_host,ssh_port,keyfile,ssh_user,db_host,db_name,sql,db_port,db_user,db_passwd):
with SSHTunnelForwarder(
(ssh_host, ssh_port),
#ssh_password=sshpasswd,
ssh