我目前正在为测试我的软件所需的 postgres 9.1 数据库而苦苦挣扎。我没有创建这个数据库,但我以前用 postgres 作为用户和密码登录。但是,现在我无法从运行数据库的同一台机器上创建连接,即使 pgadmin3 也是如此。我在 pg-hba.conf 中尝试了一百万种组合,例如:
host all all 192.168.10.178/32 trust
或者
host all all 0.0.0.0/0 trust
或者
host example postgres 192.168.10.178/32 trust
或者
host all all ::1/128 md5
服务器的ip4地址是192.168.10.178,子网掩码是255.255.245.0。这台机器正在运行 Windows Server 2008,并且我以管理员权限登录(如果这很重要)。在 postgresql.conf 中设置了以下几行:
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
port = 5432 # (change requires restart)
我对 postgres 一点也不熟悉,直到现在我读到的关于 pg_hba.conf 的内容并没有让我更进一步。我本来希望至少使用上面的第二个设置,它可以让我无需密码即可登录,而不关心用户或主机 IP。但不知何故,pgadmin 3 仍然要求用户“postgres”的密码,如果我使用“postgres”,它只会告诉我:
password-authentication for user 'postgres' failed
拜托,谁能告诉我到底该怎么办?