微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Linux 中的 Rails服务器是否在主机“localhost”(::1) 上运行并接受端口 5432 上的 TCP/IP 连接?

如何解决Linux 中的 Rails服务器是否在主机“localhost”(::1) 上运行并接受端口 5432 上的 TCP/IP 连接?

免责声明:我经历了相同的标题,但没有一个能帮助我解决我的问题。

我安装并启动了一个 postgresql 服务器: 我首先删除 pgdata/postmaster.pid 以确保与其他帖子不同。 然后
pg_ctl start
lsof | grep 5432 -> 什么都没有

pg_ctl start -> ...侦听 Unix 套接字“sockets/.s.PGsql.5432”...数据库系统已准备好接受连接... lsof | grep 5432 -> postgres 1495 用户名 4u unix 0x0000000000000000 0t0 16163716 sockets/.s.PGsql.5432 type=STREAM

然后我去:rake db:setup,我得到:

Could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
Could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
Couldn't create 'seqresults-test' database. Please check your configuration.
rake aborted!
PG::ConnectionBad: Could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
Could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

然后我就可以用客户端访问数据库了。

$ psql

然后

postgres=#

请帮忙!所有这些对我来说都像是黑魔法,但它不起作用。
如果有人能简要解释这是如何工作的,我也将不胜感激。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。