MyODBC cannot connect to remote MySQL database

Posted on 2004-11-11
Last Modified: 2012-06-27
Hi there. I have a two servers connected to the net, and a MySQL server running on a LAN at my office. The LAN is protected by a firewall which has port 3306 forwarded to the MySQL machine.

One of the computers on the net can access the MySQL data, and one cannot even connect to it.

I try from my house and various other computers and they all work fine. Its just one server that cannot access it.

The one that doesn't work is a NT4 Server, but it used to be fine, and it used to "see" the data until one day the mysql server failed, and since it has been rebuilt it cannot access it.

Does anyone have any ideas of why this one machine cannot view it? It can ping the router that the mysql server is connected to, but nothing other than that.

Thanks, Chris
Question by:christatedavies
    LVL 17

    Expert Comment

    Can you provide some error information? Is MyODBC installed properly? What application are you trying to use to access the database? Did you reconfigure a proper DSN?

    Mike Hillyer
    LVL 2

    Author Comment

    I am trying to use a system DSN which used to work fine. On the MyODBC DSN window there is a test button and this takes around 1 minute to come back with an error "Cannot connect to MY SQL server on"

    From other machines, the test is successful...
    LVL 7

    Expert Comment

    Here are some things to try...

    1. Make sure your two machines can send packets to each other.  

    Go to the command prompt on your MyODBC machine.  Run "ping" and make sure you can ping your MySql server.  If you can't try "tracert" and see where the packets are getting lost.  

    2. If your ping works OK, then you can send packets.  Try connecting to the specific port MySql uses.  

    Again from the MyODBC machine type "telnet 3306".  If you get "Could not open connection ..... Connect failed" then something is stopping the rejecting the connection between you and the server machine.

    Most likely a firewall or something is not allowing you to connect, or possibly the MySql server is running on a non-standard port.
    LVL 2

    Author Comment

    I cannot connect, but the server management says there is nothing blocking the port.

    Is there any tracing tool I can use to see where its getting stopped?
    LVL 7

    Expert Comment

    tracert will show you each hop between your computer and the server.  That is the "tracert".  It would show something like this...


    Tracing route to []
    over a maximum of 30 hops:

      1    <1 ms    <1 ms    <1 ms
      2   127 ms   127 ms   127 ms
      3   128 ms   128 ms   128 ms
      4   140 ms   138 ms   144 ms
      5   140 ms   145 ms   141 ms []
      6   148 ms   143 ms   141 ms []

    Now there are lots more hops between myself and the whitehouse, but you will sometimes get something like...

      7   reports: Destination net unreachable

    or timeout or some other error.

    Every router that passes your packet on to the next one is a hop, and one of those is what's stopping things.
    LVL 2

    Author Comment

    Passes that fine. It can see the server, just not the mysql installation on it.
    LVL 7

    Accepted Solution

    When you said it can't connect I thought you mean the ping, not the telnet.

    You can't connect on that port, but can ping the machine.  So the packets get through, but the MySql machine rejects them.  This means that MySql isn't running on that port, or a firewall on the MySql machine is not letting them through.  The only things I can think of anyway.  I still can't think of why it would do that for only one machine.  

    Try connecting to other services on the MySql machine.  Make sure you can communicate on some other port.  That's all I can think of right now.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API ( …
    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now