Have you ever transfered code from one machine to another and not have it work? If you’re a programmer or have ever attempted to program I would imagine that you’ve run into this at least once. In my case I take windows developers code which has been developed to work on solaris (poorly sometimes I might add) and build my development environment around that base to work from.
Today I spent 4 hours trying to figure out why the code that works perfectly well on one machine would not work on mine. Ultimately the error I was getting was “connection Refused” when trying to connect to my local mysql database. I traced through the code, made sure everything was correct, printed out all the user account information to make sure all was well, make sure the database and everything was running, listening, accounts worked, make sure connecting on the port and not using the local socket worked….everything worked and looked correct but my application consistently kept getting “Connection Refused”.
3-4hours later over digging though everything I could think of I was somehow lead down the path of “What is localhost really pointing to?” Sure enough I look in my host file (if you don’t know what that is…leave…NOW) and found that localhost was pointing to “::1″ the IPv6 equal of 127.0.0.1. I’m not sure if it wouldn’t connect because mysql wasn’t listing on any IPv6 interfaces, or if it’s because there was no loopback IPv6 virtual adapter, but either way changed the entry appears to fix the problem. Not that I tested a lot after I got it working… I promptly left work after solving it. I don’t know of many developers who would have figured something like that out. Hell, I don’t know many networking people who would have thought of that. I’m not even really sure how I thought of it? I mean, seriously, who troubleshoots that “localhost” is wrong when accessing a web page, mysql from the command line, and everything else you are using localhost for actually works.
Anyway, in summary, those of you who are developing on Fedora 6 and probably the new 7 be aware that ::1 != 127.0.0.1.