Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HeidiSQL connecting to mysql server - Lost connection...server at reading initial

Tags:

mysql

heidisql

New to connecting to databases and have no clue to where to begin to troubleshoot -

I am currently using HeidiSQL to connect to an external Mysql Database Server hosted on the Amazon Web Service - EC2.

I am able to access the database using HeidiSQL with the settings: MySQL (SSH tunnel) Hostname/ip: 127.0.0.1 user: (user) password: (pw) port 3306

in SSH tunnel tab: plink.exe location is set to putty.exe sshhost + port: (my host ip) port 22 private key file: (is set) local port: 3307

Using this configuration I AM able to log into my database. My problem is when I am trying to do it using my own putty commands using the port forwarding:

In Putty: I set SSH>tunnels - source port: 3307, destination (my host ip):3306 Local and Auto. I connect using my passwords and hostip

Back to HeidiSQL, I put my settings to: MYSL (TCP/IP) hostname: localhost user: (user) password(pw) port 3307

and try to connect. I get the following error: SL ERROR (2013): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

From what I have read, this means my ssh tunnel is working but something else is wrong. I am now at a loss on why this doesn't work. Am i not setting something else up properly? Firewalling myself? My ultimate goal is to hook up another application to communicate with the database using ODBC orJDBC using the same port forwarding idea. Are there logs to check somewhere?

like image 276
user1639926 Avatar asked Nov 13 '22 22:11

user1639926


1 Answers

You must set

AllowTcpForwarding yes
PermitTunnel yes

in /etc/ssh/sshd_config

like image 78
Matt Weiss Avatar answered Nov 15 '22 12:11

Matt Weiss