我的服务器是Debian 7,我使用的是PostgreSQL 9.3。
这是我的主人档案:
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
文件中将其设置为正确并重新启动它。
答案 0 :(得分: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。