(help, patience and mercy... begginer lost haha)

-Ok heres the deal, im trying to connect a EC2 Instance to MySQL throught SSH in MySQL Worckbrench

-I set up the configurations this way

SSH Hostname: My Public DNS

SSH Username: ec2-user

and the keyfile of instance

MySQL Hostname:

MySQL Serverport: 3306

Username: root

(This last part was leave it as default)

-When i try to connect it pop's up this error:

"Failed to Connect to MySQL at 127.00.1:3306 through SSH tunnel at my server dns whit user root Lost connection to MySQL server at "reading initial communication packet", system error: 0

-I find some posible solution, but i dont know if they dont work for my case or i just get them wrong

-The most ussual solution suggest to change the bind addres of the SQL my.ini from to but in the 5.6 version of MySQL The default address is al ready set (http://dev.mysql.com/doc/refman/5.1/en/server-options.html) and i cant even find the bind addres section in my.ini

I find everything in order in my EC2 server and i can conncet via ssh throught the comand, so i guess the ssh configuration is in order too

What im missing?

  • 1
    typo... typo everywhere... – tpml7 Dec 18 '14 at 22:16
  • and the keyfile of my server <-- If that's not a typo.. you're doing it wrong. You should have a key you created for the CLIENT, then you put the public portion of that key into authorized_keys on the server. – yoonix Dec 18 '14 at 23:25
  • it's the public key of my ec2 instance. As long as i see it's the key i have to use there. Sorry for the bad english. – Santiago Ros Dec 18 '14 at 23:33

When I had that problem, it was because the host name used in the 'connection' part of you mysql client wasn't resolving properly its name in the MySQL's server to the server itself.

Usually I had to change the /etc/hosts and add localhost to the entry.

Your case doesn't seem to be the same as you are using the ip!

BTW, have you mistyped 127.00.1:3306? There is a dot missing in there.


Try making the tunnel yourself with

ssh -f -L 3306:localhost:3306 -N

Then just connect to localhost:3306 without SSH encryption.

  • Begginer question: It dont allows me: "Permission denied (publickey)." Where do i put the publickey? – Santiago Ros Dec 18 '14 at 22:51
  • 1
    You generate it with ssh-keygen and add it with ssh-copy-id user@host also it should be ssh -f -L 3306:localhost:3306 user@ -N if you dont use the same username on both machines. – user3850506 Dec 18 '14 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.