【发布时间】:2020-12-24 02:05:07
【问题描述】:
Disclamer:我经历了相同的标题,但没有一个能帮助我解决我的问题。
我安装并启动了一个 postgresql 服务器:
我首先删除pgdata/postmaster.pid 以确保与其他帖子的问题不同。
然后pg_ctl startlsof | 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=#
请帮忙!在我看来,这一切都像是黑魔法,但它不起作用。
如果有人能简要解释一下这是如何工作的,我也将不胜感激。
【问题讨论】:
-
你可以试试这个方法吗? stackoverflow.com/questions/65427026/…
-
@Danizavtz。谢谢你。我没有 sudo 权力。有什么选择?
-
你试过 docker 吗?
-
@Danizavtz。不,我不知道怎么做。
-
托管服务可以替代您吗? aws 或谷歌 gcp。如果你在 heroku 中有一个实例,你可以免费拥有一个数据库,直到 10K 行。 atlas (mongodb) 中还有 500Mb 的免费空间。如果没有,也许你可以使用 sqlite(本地文件系统)。有一个 postgresql 托管服务,叫做大象sql(我没用过)。
标签: ruby-on-rails linux postgresql