Server won't allow outgoing connections on port 3306?

Discussion in 'Site & Server Administration' started by BillyConnite, May 18, 2011.

  1. #1
    Hi all,

    I have 2 servers running, and am trying to get server A to connect to server B's mySQL database.

    I have opened port 3306 on server B to allow incoming connections from server A's IP and also my IP here locally (hostnames also).

    Yet i still cannot connect from server A to server B via port 3306. I know server B is configured correctly as I CAN connect to port 3306 just fine from my local IP here.

    Anyone able to help me out on this?

    Both servers are running CentOS 5.6.

    Thanks,
    Rhett.
     
    BillyConnite, May 18, 2011 IP
  2. lachrymologist

    lachrymologist Active Member

    Messages:
    456
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    70
    #2
    set the user permission on server B so that server A's ip address is allowed to connect to the DB
     
    lachrymologist, May 18, 2011 IP
  3. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #3
    Sorry, done that, to allow both my local IP and server A's IP.

    Works fine here locally, but not from server A. It seems like i can't allow outgoing connections from Server A to server B... but i don't know why.
     
    BillyConnite, May 18, 2011 IP
  4. RonBrown

    RonBrown Well-Known Member

    Messages:
    934
    Likes Received:
    55
    Best Answers:
    4
    Trophy Points:
    105
    #4
    Is MySQL set-up to allow remote connections? It could be the issue is with MySQL rather than a firewalling problem.

    If it's a firewall issue, you might have to create an outgoing rule from ports 0-65535 (or maybe 1024-65535) on server A to 3306 on server B. There may be a narrower range of ports you could open on server A, but off the top of my head I don't know the port range that would be used to connect to MySQL.
     
    RonBrown, May 18, 2011 IP
  5. madaboutlinux

    madaboutlinux Member

    Messages:
    250
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    43
    #5
    Stop the firewall on both the servers and see if you are able to connect. If not, from Server A command prompt, try to connect to Server B database directly and see what error you receive:

    If you are unable to connect, it indicates that the user do not have enough permission from Server A IP to connect to Server B database. In this case, goto the mysql prompt on Server B and grant the privileges (do this using below method though you may have done that from control panel)

     
    madaboutlinux, May 18, 2011 IP
  6. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #6
    Hi all,

    Thanks for your replies! I didn't think to stop firewalls to troubelshoot.

    Stopping both firewalls allows Server A to connect to server B just fine. Server A's firewall here is the issue, and i'm assuming as RonBrown said i need to open up those ports for outgoing connections to server B. I'll work on this and let you know how i go :)

    Anyone know the port range MySQL likes to use with outgoing connections? (1024-65535)? Or anyone know if i can configure a port range within MySQL.

    Thanks,
    Rhett.
     
    Last edited: May 18, 2011
    BillyConnite, May 18, 2011 IP
  7. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #7
    Solved!

    Thanks guys, i wasn't opening ports properly on server A, I was specifying the source address as the remote address instead of local :eek:
     
    BillyConnite, May 18, 2011 IP