0

I have a problem connecting to my MySQL server running on a linux machine. It works fine from the local network (any computer in the same network).

Anyway, no connection can be established from other networks.

I have no idea why..

In the my.cnf I've set the port=3306 and bind-address=0.0.0.0.

netstat -an | grep 3306
returns    
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN

The MySQL user is created like this

create user 'user'@'%' identified by 'pass';
create user 'user'@'localhost' identified by 'pass';

grant select on *.* to 'user'@'%';
grant select on *.* to 'user'@'localhost';

A portforwarding for port 3306 is configured in the router.

The file hosts.deny is empty.

As far as I can tell my server is listening on 3306 and nobody is between it and any client who blocks, still nobody but local clients can connect.

I've tried many solutions I found on stackoverflow but none of them helped..

I also have to admit I'm not that much used to Linux, so please give "noob-instructions" :)

Stefan
  • 652
  • 5
  • 10
  • If you say other networks, are you on a private network, and the other networks are somewhere on internet? because in that case you will have to port forward mysql's port on your internet router. – fvu May 09 '16 at 12:52
  • have you tried verifying whether your server is reachable on port 3306? If you can, stop MySQL on that port, and run `nc -l 3306` on the server. From the client connecting from outside your LAN, run `nc yourServerIP 3306`, type something and hit enter. If you can see what you typed on the server, the network configuration is ok. – michele b May 09 '16 at 12:54
  • yes, it's another network over the internet. Anyway, the port is actually already forwarded on the router. – Stefan May 09 '16 at 12:54
  • @micheleb Only my server runs on linux, is there any way I can do this with a windows machine? – Stefan May 09 '16 at 12:55
  • you can replace `nc` with `telnet` on windows – michele b May 09 '16 at 12:57
  • That doesn't work. I receive "Connecting to example.com...Could not open connection to the host, on port 3306: Connect failed" at the client – Stefan May 09 '16 at 12:59
  • have u try this `http://stackoverflow.com/questions/14779104/how-to-allow-remote-connection-to-mysql` – Asad May 09 '16 at 13:01
  • @Asad yes, I've tried this one as well, no success :( – Stefan May 09 '16 at 13:07
  • you need to replace `example.com` with the actual IP of your server :) – michele b May 09 '16 at 14:12
  • Still not working. Anyway, domain works with other ports ;) – Stefan May 09 '16 at 14:15

1 Answers1

0

After many "try and error"-approaches I figuered it out, I had to comment out the line "skip-external-locking" in the mysql config file.

I hope this might help someone having the same problem :)

Stefan
  • 652
  • 5
  • 10