Re: Connecting PHP to MySQL on Windows - RESOLVED

Re: Connecting PHP to MySQL on Windows - RESOLVED

am 11.01.2011 05:08:12 von michael manning

--001636c92436a9aa1a04998a3bcc
Content-Type: text/plain; charset=ISO-8859-1

Hi,

Thanks to everyone who assisted me.

Removing the line:
::1 localhost

from the c:\windows\system32\drivers\etc\hosts file did the trick and
allowed me to access MySQL databases without any problems.

I confirmed this was the correct solution by re-adding the line and seeing
it fail again, removing the line again and successfully connecting. So the
problem was nothing to do with Apache, PHP or MySQL directly but was a local
networking issue. Of course, the hosts file on my working Windows XP
computer at home did not have this line in the hosts file

Many thanks again.

Mike
michaelgmanning@gmail.com

On Sat, Jan 8, 2011 at 7:06 AM, Gavin Chalkley wrote:

> Mike,
>
> A plain HOST file should have the commented part at the top, and only 1
> reference to localhost unless you are creating Virtual hosts.
>
> I would suggest removing the "::1" line
>
> BR
>
> Gavin
>
> On Fri, Jan 7, 2011 at 4:18 AM, michael manning
> wrote:
>
> > Hi,
> >
> > I swapped out 'localhost" for '127.0.0.1' in the url but this had no
> > effect.
> >
> > I had a look at my hosts file at c:\windows\system32\drivers\etc and this
> > contained:
> >
> > # Copyright (c) 1993-2006 Microsoft Corp.
> > #
> > # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
> > #
> > # This file contains the mappings of IP addresses to host names. Each
> > # entry should be kept on an individual line. The IP address should
> > # be placed in the first column followed by the corresponding host name.
> > # The IP address and the host name should be separated by at least one
> > # space.
> > #
> > # Additionally, comments (such as these) may be inserted on individual
> > # lines or following the machine name denoted by a '#' symbol.
> > #
> > # For example:
> > #
> > # 102.54.94.97 rhino.acme.com # source server
> > # 38.25.63.10 x.acme.com # x client host
> >
> > 127.0.0.1 localhost
> > ::1 localhost
> >
> > and so this seems fine as well.
> >
> > cheers
> >
> > Mike
> >
> > On Fri, Jan 7, 2011 at 1:25 PM, Daniel Brown wrote:
> >
> > > On Thu, Jan 6, 2011 at 21:12, michael manning <
> michaelgmanning@gmail.com
> > >
> > > wrote:
> > > > Hi Daniel,
> > > > When testing with the CLI, netstat shows:
> > > [snip!]
> > >
> > > What happens when you swap out 'localhost' for '127.0.0.1' in the
> > > connection routine? If that works, check to make sure your hosts file
> > > properly designates 127.0.0.1 as 'localhost' (by editing
> > > c:\windows\system32\drivers\etc\hosts I believe.... been a while since
> > > I've done it on Windows).
> > >
> > > --
> > >
> > > Network Infrastructure Manager
> > > Documentation, Webmaster Teams
> > > http://www.php.net/
> > >
> >
>
>
>
> --
> Best regards,
>
> Gavin C
>

--001636c92436a9aa1a04998a3bcc--