Hello! I've recently installed Windows 8 and since that moment my XAMPP installation has been acting a bit weird it takes over a second to establish a mysql connection (mysql_connect) where it used to take less than 0.01 seconds.Timed:

Timer 1 (mysql_connect): 1.02864
Timer 2 (select_db): 0.00023

I have found a solution: instead of using mysql_connect('localhost'...) I use mysql_connect('127.0.0.1'...). New timers:

Timer 1 (mysql_connect): 0.00446
Timer 2 (select_db): 0.00023

However, I want to be able to just connect to localhost! :) I've checked my hosts file. It does contain a line saying "127.0.0.1 localhost" and the line "::1 localhost" (the ipv6 variant) has been commented out with a #. It's just not working. Any suggestions?

Member Avatar for LastMitch

I've checked my hosts file. It does contain a line saying "127.0.0.1 localhost" and the line "::1 localhost" (the ipv6 variant) has been commented out with a #. It's just not working. Any suggestions?

This is your localhost:

127.0.0.1

If you have a file called 'index.php'

just type this on your browser 127.0.0.1/index.php

then that file will appear.

Hey LastMitch, thanks for your reply! The point is: I want to be able to use "localhost" everywhere, as I'm used to, instead of "127.0.0.1". Many users reporting the same slow mysql_connect problem have been told to edit their hosts file and add the line I was talking about to it. For me, the line was already there, so it did not solve my problem. Anything else I can do to get rid of having to type 127.0.0.1 instead of "localhost"? :)

Member Avatar for LastMitch

@minitauros

For me, the line was already there, so it did not solve my problem. Anything else I can do to get rid of having to type 127.0.0.1 instead of "localhost"? :)

You can try this:

http://ubuntuforums.org/showthread.php?t=1036836

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.