1

I'm trying to access amazon ec2 mysql server remotely.

My problem is(for sure) with Mac OSX. Cause when I try to connect through the same mysql client(MySQL Workbench 6.0) on windows inside a VM hosted from this very same MacOSX machine, it works just fine.

I've searched a lot about this problem. And this guy figured the problem was with a third-party app called iStatPro(which is actually a dashboard widget). I had the same widget, and I tried to remove it, and it didn't work.

Is it possible that some other app is blocking my 3306 port(or the 22 ssh default port for that matter)? If so, what is the best way to figure which one?

Thanks in advance.

EDIT:

The error I get when trying to connect, is exactly the same error that guy gets. Which is:

Your connection attempt failed for user 'xxxx' from your host to server at xxxx.yyyyy.zzzzz.edu:3306:
Can't connect to MySQL server on 'xxxx.yyyyy.zzzzz.edu' (61) 

EDIT [2]:

Also, then I try to connect using mysql workbench it refuses the connection immediately. Making me think, it don't even have the chance to connect to ssh tunel, getting refused locally.

EDIT [3]:

The parameters I'm using to connect to the mysql remote server is: SSH Hostname: 99.999.999.999:22 SSH Username: ubuntu SSH password: empty SSH Key File: respective .pem file MySQL Hostname: 127.0.0.1 MySQL Server Port: 3306 Username: root Password: mypassword default_schema: my_default_schema

EDIT [4]:

I can establish the connection through terminal just fine.

4

2 回答 2

1

要解决 MySQLWorkbench 中的 SSH 连接问题,您必须首先在终端中手动创建 SSH 隧道:

ssh -nNT -L 1234:my-ec2-server.us-west-1.rds.amazonaws.com:3306 firstname.lastname@xxx.xxx.xxx.xxx

在哪里:

  • SSH 标志说明:这里.
  • 1234= 您计算机上的本地端口
  • 3306= 主机上的标准 MySQL 数据库端口,映射到
  • firstname.lastname= 您的 SSH 登录用户名
  • xxx.xxx.xxx.xxx= SSH 网关机器的 IP 地址(堡垒主机)

然后设置 MySQLWorkbench 以连接到端口 1234 上的 localhost 数据库:

MySQLWorkbench -> 数据库 -> 管理连接 -> 新建 -> 指定名称

  • 连接方式 =标准 TCP/IP
  • 主机名 =本地主机
  • 端口 = 1234
  • 用户名 =您的 MySQL 用户名
  • 默认架构 =您的数据库名称

完成数据库操作后,在终端中按Ctrl+C手动断开/关闭 SSH 隧道。

于 2018-04-12T17:13:25.797 回答
0

尝试使用Network utility(应用程序 > 实用程序 > 网络实用程序),在最后一个选项卡中,您可以port scanlocalhost.

每个正在使用的端口都将与正在使用该端口的服务的名称一起被监听。

希望这可以帮助。

于 2013-11-02T20:22:22.547 回答