1
votes

I found similar questions but none of them helped me with a windows machine.

I was able to connect to mySQL through my local machine. However, I have placed MySQL on a remote machine and when I try to connect to it, I get the following error:

Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Im using SQL workbench to connect. I use the remote machine's actual name for the hostname and using port 139. I have MySQL started up as a service on the remote machine as well. When googling the error I get lots of jazz about editing a file in /etc/hosts.allow and my.cnf and whatnot. However, these locations were specified for linux machines. I have a windows 7 machine for both my local and the remote machine and therefore do not have these locations.

Any help would be greatly appreciated.

2
Why port 139? That's Windows NetBIOS. MySQL uses 3306 by default.Jim Garrison
Because after doing a netstat -na I found that it was listening to dthub1 with a port of 139. If I use 3306 it instantly fails. That might be because I'm not using localhost since I'm trying to connect to another machine.Daniel Julian
How do you know port 139 is associated with MySQL? Any Windows machine will always be listening to port 139.Jim Garrison
I don't, so that's probably the problem. However, it's not listening to 3306 so that is also a problem.Daniel Julian

2 Answers

3
votes

I am not going to pretend that I know what caused this problem but it could be:

1.That you need to add

AllowTcpForwarding yes

to this file: /etc/ssh/sshd_config. Obviously since you are on windows you need to find its equivalent because that's a linux filepath.

2.It could be your firewall. Try temporarily disabling it (if it is safe to do so) and see if it works. If this is the case you will need to grant MySQL access through the firewall.

3.Try writing

mysqld: ALL: allow

In the file /etc/hosts.allow again since you are on windows you need to find its equivalent because that's a linux filepath. Now this may kind of be a security whole in some ways but who cares about security when you don't have a running server?

4.Now the last this is to check /etc/hosts.deny your IP might be there denying you access to your server.

0
votes

Figured it out. 'root' was pointing to the root of the local machine and the root user on the remote machine was pointing to itself. So I had it connect to an admin user and it connected fine with no errors. Thanks for for the responses and help guys.