在终端中输入 postgres -D /usr/local/var/postgres 时得到这个结果

Get this result back when putting `postgres -D /usr/local/var/postgres` in terminal

当我在终端中输入 postgres -D /usr/local/var/postgres 时,我得到了这个:

LOG: could not translate host name "localhost", service "5432" to address: nodename nor servname provided, or not known
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets`

有人可以帮我解决这个问题吗?

检查您的 /etc/hosts 文件是否缺少行:

127.0.0.1 localhost.localdomain 本地主机

此致

H