Jump to content

Setup And Installation


ShadowMage

Recommended Posts

Did you tried that already? Did it failed?If it did, I must tell you... for some very peculiar reason, I had this same problem today, and I still can't believe how I was able to solve it... replace "localhost" with "127.0.0.1". Yeah, for some reason, MySQL isn't resolving intranet names or is trying to use DNS instead of the hosts file (and a DNS lookup will fail, because no domain server lists "localhost"; that's what the "hosts" file is for). Because it can't resolve the name, MySQL never replies in time, and therefore it times out.

Link to comment
Share on other sites

  • Replies 55
  • Created
  • Last Reply
Did you tried that already? Did it failed?If it did, I must tell you... for some very peculiar reason, I had this same problem today, and I still can't believe how I was able to solve it... replace "localhost" with "127.0.0.1". Yeah, for some reason, MySQL isn't resolving intranet names or is trying to use DNS instead of the hosts file (and a DNS lookup will fail, because no domain server lists "localhost"; that's what the "hosts" file is for). Because it can't resolve the name, MySQL never replies in time, and therefore it times out.
No I haven't had a chance to try it yet. I've been pretty busy the last few days.That's great that you had a similar problem and were able to solve it! I'm gonna definitely give that a shot.Actually I think dsonesuk made mention of that...............yep, post #32It looks to me like dsonesuk is suggesting a programmatic change to a configuration. I really don't want to do that if I don't have to. Would it work to just change 'localhost' to '127.0.0.1' in the mysqli_connect function? Ie, mysqli_connect('127.0.0.1', 'user', 'pass');Or could I leave that as 'localhost' and just add an entry in the hosts file for 'localhost'?
Link to comment
Share on other sites

Errr... yeah... that's... what I had in mind - replace "localhost" in the connect function with "127.0.0.1"... what else did you think replacing localhost with 127.0.0.1 means? In the address bar? No. That's irrelevant for the communication between PHP and MySQL.[edit]Saw the earlier comment you were reffering to... no, that's not the kind of alteration I had in mind, though it may be a good idea to verify that too, just in case.[/edit][edit]I did add explicitly localhost to the hosts file, but for some reason, even after a reboot, "localhost" still doesn't work. But 127.0.0.1 sure does.[/edit]

Link to comment
Share on other sites

FANTASTIC!!!!!It works! I just added localhost to the hosts file and now it connects just fine. Thank you dsonesuk for the original suggestion, and thank you boen_robot for confirming it and all the time you've taken to help me through this.Thanks again!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...