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 (将#修改为@)