by PeteX » Mon Mar 16, 2009 2:59 pm
Ok, I found the problem!!!
I decided to check first if there is someone listening to port 5432 and did this:
C:\>netstat -na
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
... (clip)...
TCP [::1]:5432 [::]:0 LISTENING
....
Hold on, what's this [::1]:5432??? Ah, it's a bloody IPv6 localhost! So, for some reason PostgreSQL is binding itself to the IPv6 localhost! So, let's see what ping says:
C:\>ping localhost
Pinging PeteXComp [::1] from ::1 with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Woot?!? I'm used to seeing 127.0.0.1 there and not ::1. So why is "localhost" mapping to ::1?
Well, have a peek at the c:\windows\system32\drivers\etc\hosts file and whats in there:
# 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
::1 localhost
So, some bugger has mapped ::1 to "localhost" without me knowing it... Windows update or what, who knows?
Anyways, adding a # on front of ::1 (or changing ::1 to 127.0.0.1, I guess as well) fixed the thing! Just logged out and back in and sure enough, netstat -an says now:
...
TCP 127.0.0.1:5432 0.0.0.0:0 LISTENING
...
There you go!!!
Now pgAdmin III is working again like a charm!