SQL Error(2013) Lost Connection: reading initial communication packet

[expired user #6463]'s profile image [expired user #6463] posted 12 years ago in Creating a connection Permalink
Hi, I am able to connect to mysql on Hostgator over TCP, which works great but ssh has caused the following error:

SQL Error (2013): Lost connection to MySQL server at 'reading inital communication packet', system error:0

I used putty and is ablke to connect to ssh and mysql without problems using the same credentials as below:

Settings:
Network type: MySQL (SSH Tunnel)
Hostname/IP: 127.0.0.1
User: mysql_user
Password: mysql_password
Port: 3306
Database: mysql_database

SSH Tunnel:
plink location: plink_location
ssh host: ssh_ip
ssh port: 2222
user: ssh_user
password: shh_password
local port: 3307

Any help is much appreciated.

[expired user #6463]'s profile image [expired user #6463] posted 12 years ago Permalink
Anyone? Thanks in advance.
ansgar's profile image ansgar posted 12 years ago Permalink
Probably too slow connection. Or something in the SSH server which does not work as expected. Well, just guesses here. It's very difficult to debug these tunnel connections.
[expired user #6463]'s profile image [expired user #6463] posted 12 years ago Permalink
Thanks anse, probably not too slow as I could putty in manually. Thanks a million, the program rocks but too bad can't tunnel at this time.
ansgar's profile image ansgar posted 12 years ago Permalink
At least the error message "reading inital communication packet" tells me your tunnel works, as you already touch the mysql server. Well, that does not make it easier to debug :)
[expired user #6512]'s profile image [expired user #6512] posted 12 years ago Permalink
I had the same problem.

I was able to solve it to change the bind-address on the mysql server.
It was set to only listen to the remote ip address.
When I changed it to 0.0.0.0 (all address, including localhost) it worked.
[expired user #6960]'s profile image [expired user #6960] posted 11 years ago Permalink
Note to self: When setting up SSH, you MUST set the following option in /etc/ssh/sshd_config:

AllowTcpForwarding yes


If you don't, then your packets will be silently dropped at the server. This results in the above error message.
davidshq's profile image davidshq posted 9 years ago Permalink
@achbed - This option is set by default to yes according to OpenSSH documentation? Just stumbled upon this thread as I am having this problem and trying to resolve.
[expired user #9542]'s profile image [expired user #9542] posted 9 years ago Permalink

My solution was to change the "bind-address" IP in the MySQL config file "/etc/mysql/my.cnf". It was set to the local IP of the server instead of "127.0.0.1" :-)

[expired user #9542]'s profile image [expired user #9542] posted 9 years ago Permalink

My solution was to change the "bind-address" IP in the MySQL config file "/etc/mysql/my.cnf". It was set to the local IP of the server instead of "127.0.0.1" :-)

I know I cannot connect directly to the server from outside. It seems I have to set the IP to "0.0.0.0" and then use the firewall to restrict access if I want any.

abu's profile image abu posted 4 years ago Permalink

Note to self: When setting up SSH, you MUST set the following option in /etc/ssh/sshd_config:

[code]AllowTcpForwarding yes[/code]

If you don't, then your packets will be silently dropped at the server. This results in the above error message.

This comment relates to SSH server configuration, or to SSH client (putty or whatever)?

Thanks

AnonymeForLiberty's profile image AnonymeForLiberty posted 3 years ago Permalink

Note to self: When setting up SSH, you MUST set the following option in /etc/ssh/sshd_config:

[code]AllowTcpForwarding yes[/code]

If you don't, then your packets will be silently dropped at the server. This results in the above error message.

You saved me. Couldn’t connect to my NAS Synology because of that. Thank you.

MAB's profile image MAB posted 1 year ago Permalink

I had a similar problem after misconfiguring a query and it locked HeidiSQL up so had to crash out.

I use XAMPP so went to services, stopped MAriaDB from running and then restartted it and it all worked fine again so guess the problem had been caused by a corrupted connection.

Please login to leave a reply, or register at first.