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.

5
  • How are you establishing the tunnel? When you forward a port via tunnel, your mysql host becomes localhost as ssh forwarding listens to your port locally and forwards packets to the remote server. Commented Nov 2, 2013 at 20:08
  • @datasage I forgot this. Updated the question. I was already using 127.0.0.1 Commented Nov 2, 2013 at 20:13
  • Its not entirely clear where the problem is. It sounds like you are establishing the tunnel with your mysql client. Normally this should be fine, but you may want to see if you can correctly establish the tunnel via ssh first. Commented Nov 2, 2013 at 20:20
  • @datasage I can. I said that I could either inside a VM running Windows XP and through terminal. Commented Nov 2, 2013 at 21:44
  • Actually, I did not said anything about using the terminal. Updated! Commented Nov 2, 2013 at 21:45

2 Answers 2

1

To workaround the SSH connection problem in MySQLWorkbench, you must first create an SSH tunnel manually, in the Terminal:

ssh -nNT -L 1234:my-ec2-server.us-west-1.rds.amazonaws.com:3306 [email protected]

Where:

  • Explanation of SSH flags: here.
  • 1234 = Local port on your computer
  • 3306 = Standard MySQL database port on the host, to map to
  • firstname.lastname = your SSH login username
  • xxx.xxx.xxx.xxx = IP address of your SSH gateway machine (Bastion Host)

Then setup MySQLWorkbench to connect to a localhost database on port 1234:

MySQLWorkbench -> Database -> Manage Connections -> New -> Specify a name

  • Connection Method = Standard TCP/IP
  • Hostname = localhost
  • Port = 1234
  • Username = Your MySQL username
  • Default Schema = Your database name

When you have finished working with the database, press Ctrl+C in the Terminal to manually disconnect/close the SSH tunnel.

Sign up to request clarification or add additional context in comments.

Comments

0

Try using Network utility (Applications > Utilities > Network Utility), In the last tab you can run a port scan on localhost.

Every port which is being used will be listen together with the name of the service which is using the port.

Hope this helps.

1 Comment

On mavericks network utility is no longer located at this folder. And what am I supposed to look there? Cause the issue here is with a remote connection, not local. Thanks for your response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.