PostgreSQL无法创建任何TCP/IP套接字的小牛

Tho*_*phy 14 sockets postgresql tcp osx-mavericks

我正在通过brew安装.

错误消息:

我打电话的时候

postgres
Run Code Online (Sandbox Code Playgroud)

我收到错误

LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG:  could not bind IPv4 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and  retry.
LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
Run Code Online (Sandbox Code Playgroud)

运行

postgres -D /usr/local/var/postgres
Run Code Online (Sandbox Code Playgroud)

创建相同的错误

createdb
Run Code Online (Sandbox Code Playgroud)

提示我输入我的密码两次,然后说,

createdb: could not connect to database template1: FATAL:  password authentication failed for user "thomasmurphy"
Run Code Online (Sandbox Code Playgroud)

我尝试了什么*卸载并重新安装pg gem,卸载并重新安装postgres*更新命令行工具*满足所有brew医生的需求*编辑pg_hba.conf的权限*编辑.bash_profile以确保它包含上述目录

我的Postgres在我的工作电脑上完美运行,也在小牛队运行,所以这让我觉得有点边缘.还有什么其他载体可以试图解决这个问题?

gpx*_*lcj 14

你得到的错误是因为你的主机坏了.检查你的/etc/hosts文件.

放在127.0.0.1 localhost第一行主机上.


Chr*_*ers 6

你得到的错误是因为PostgreSQL正在运行.我怎么知道?因为它拒绝了你的密码.这很清楚.

现在您真正的问题可能是您需要在修改pg_hba.conf后重新启动PostgreSQL以获得信任访问权限.然后你可以:

 ALTER USER foo WITH PASSWORD 'bar';
Run Code Online (Sandbox Code Playgroud)

在启动和重启PostgreSQL方面,请看这个问题: 如何在Mac OS X上启动PostgreSQL服务器?