通过 SSH 隧道的 ODBC + 远程 MySQL [英] ODBC + remote MySQL over SSH tunnel

查看:63
本文介绍了通过 SSH 隧道的 ODBC + 远程 MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以困难在于使用 ODBC 连接到远程数据库.我遵循了我在互联网上找到的指南.他们告诉我建立一个 SSH 隧道,因为我的主机不允许直接连接,我使用 PLink(Putty 控制台)建立了一个.我什至可以使用控制台登录数据库(我有截图,但由于声誉限制无法发布).

So the struggle is to connect to the remote database with ODBC. I followed the guides which I found on the Internet. They told me to make a SSH tunnel because my host doesn't allow direct connections and I made one using PLink (Putty console). I can even login into the database using the console (I have a screenshot but I can't post it due to reputation restrictions).

但是当我尝试在 ODBC 驱动程序中设置 MySQL 连接器/ODBC 数据源配置时,我得到

But when I try to setup MySQL Connector/ODBC Data Source Configuration in the ODBC driver, i get

[08S01]  [MySQL][ODBC 3.51 Driver]Lost connection to MySQL server at 
'reading initial communication packet', system error: 0

我的设置:

TCP/IP Server: localhost [I tried 127.0.0.1 with no result]
Port: 3307
User/Password: I use those which were successful in signing in through console 
Database: The list is empty so I cannot choose anything

plink 是通过

Params := '-v -ssh -2 -P 22 -C -l ******** -pw ******* -L 3307:ssh.******.nichost.ru:22 ssh.******.nichost.ru';

所以端口应该没问题.不知道该怎么做,我在东西方谷歌搜索,没有发现任何帮助我:(请帮忙.

So port should be fine. Idk what to do, I googled east and west and found nothing which helped me :( Please help.

推荐答案

我不明白你的端口转发设置.你正在使用-L 3307:ssh.******.nichost.ru:22 这使您端的端口 3307 表现得好像它是远程端的端口 22;但端口 22 通常属于 ssh 服务器,而不是数据库服务器.

I don't understand your port forwarding setup. You're using -L 3307:ssh.******.nichost.ru:22 which makes port 3307 at your end behave as if it were port 22 at the remote end; but port 22 typically belongs to an ssh server, not a database server.

如果你的 MySQL 服务器在远程端监听端口 3307,你需要 -L 3307:ssh.******.nichost.ru:3307 来连接到它最后通过端口 3307.

If your MySQL server is listening on port 3307 at the remote end, you'd need -L 3307:ssh.******.nichost.ru:3307 to connect to it via port 3307 at your end.

这篇关于通过 SSH 隧道的 ODBC + 远程 MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆