简体   繁体   English

Postgres无法连接到Unix域套接字5432上的服务器

[英]Postgres cannot connect to server on Unix domain socket 5432

Using Postgres 9.2.2, I keep getting this error when I try to start up rails server or run psql 使用Postgres 9.2.2,当我尝试启动rails服务器或运行psql时,我不断收到此错误

could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

This command, when run: 此命令在运行时:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

says server starting, but when I go to check processes, no postgres process is running 说服务器启动,但是当我去检查进程时,没有运行postgres进程

My paths are correct 我的道路是正确的

$ which psql
/usr/local/bin/psql
$ which pg_ctl
/usr/local/bin/pg_ctl

If I run this command: 如果我运行此命令:

initdb /usr/local/var/postgres -E utf8

It will connect to the socket.... but it also requires me to remove my databases, which is pretty frustrating. 它将连接到套接字....但它也需要我删除我的数据库,这是非常令人沮丧的。 This seems happens every time I restart. 这似乎每次重新启动时都会发生。

Using 运用

  • Postgres 9.2.2 Postgres 9.2.2
  • Brew 酿造
  • OSX Mountain Lion OSX Mountain Lion

I found similar threads on stack overflow but none of the solutions seemed to work. 我在堆栈溢出时发现了类似的线程,但没有一个解决方案似乎有效。

Screw it. 算了。 I just installed Postgres.app by Heroku. 我刚刚安装了Heroku的Postgres.app。 No more messy issues. 没有更混乱的问题。

I saw this issue arise again once more with someone who actually had Postgres.app installed. 我看到这个问题再一次出现在实际安装了Postgres.app的人身上。 Though, it's unclear why his threw this error because I've never seen it before with Postgres.app. 虽然,目前还不清楚他为什么抛出这个错误,因为我之前从未见过Postgres.app。

The solution was changing the database.yml file from: 解决方案是从以下位置更改database.yml文件:

development: &default
  adapter: postgresql
  database: myapp_development
  encoding: utf8
  min_messages: warning
  pool: 5
  timeout: 5000

test:
  <<: *default
  database: myapp_test

To: 至:

development: &default
  adapter: postgresql
  database: myapp_development
  encoding: utf8
  min_messages: warning
  pool: 5
  timeout: 5000
  host: localhost

test:
  <<: *default
  database: myapp_test

Only difference is the "host" line 唯一的区别是“主机”线

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有这样的文件或目录服务器是否在本地运行并且在Unix域套接字“ /tmp/.s.PGSQL.5432”上接受连接? - No such file or directory Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432”? BlueHost-没有这样的文件或目录服务器是否在本地运行并且在Unix域套接字“ /tmp/.s.PGSQL.5432”上接受连接 - BlueHost - No such file or directory Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432” 没有这样的文件或目录 服务器是否在本地运行并接受 Unix 域套接字“/tmp/.s.PGSQL.5432”上的连接? 在 docker - No such file or directory Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432”? at docker 服务器是否在本地运行并接受 Unix 域套接字“/tmp/.s.PGSQL.5432”上的连接? Dockerized Rails - Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? Dockerized Rails Rails 6 无法连接到 AWS Elastic Beanstalk 预置的 RDS。 Unix 域套接字“/var/run/postgresql/.s.PGSQL.5432” - Rails 6 is unable to connect to AWS Elastic Beanstalk provisioned RDS. Unix domain socket "/var/run/postgresql/.s.PGSQL.5432" postgresql 数据库错误:服务器是否在本地运行并接受 Unix 域套接字“/var/run/postgresql/.s.PGSQL.5432”上的连接? - error with postgresql datababse : Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”? 没有这样的文件或目录服务器是否在本地运行并在Unix域套接字“ /var/run/postgresql/.s.PGSQL.5432”上接受连接 - No such file or directory Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432” Rails PG Unix域套接字“ /tmp/.s.PGSQL.5432”? 问题 - Rails PG Unix domain socket “/tmp/.s.PGSQL.5432”? issue Postgres无法连接到服务器 - Postgres cannot connect to server rails 不通过 tcp/ip 连接到 postgres,而是通过 unix socket - rails doesnt connect to postgres via tcp/ip but unix socket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM