0

我的服务器是 Debian 7,我使用的是 PostgreSQL 9.3。

这是我的hosts文件:</p>

root@localhost:/etc# cat hosts
127.0.0.1       localhost.localdomian  localhost
127.0.1.1       virtualserver.com       virtualserver

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

当我想启动一个新的psql控制台时:

root@localhost:/var/lib/postgresql/9.3/main# service postgresql restart
[ ok ] Restarting PostgreSQL 9.3 database server: main.
root@localhost:/var/lib/postgresql/9.3/main# sudo -u postgres psql
sudo: unable to resolve host localhost.localdomain
psql (9.3.0)
Type "help" for help.

可以看到机器找不到了localhsot.localdomain。但是我更改了根文件,并在我的/etc/hosts文件中使其正确并已经重新启动。

4

1 回答 1

0

您的 /etc/hosts 有错字,应该是:

127.0.0.1       localhost.localdomain  localhost
127.0.1.1       virtualserver.com       virtualserver

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

localdomain 拼写为 localdomIAn。

于 2013-09-29T10:47:34.573 回答