gpt4 book ai didi

postgresql - 无法连接到 ubuntu 中的 postgres

转载 作者:行者123 更新时间:2023-11-29 11:50:58 35 4
gpt4 key购买 nike

我正在尝试在 ubuntu 上安装 postgresql。我按照 http://hocuspokus.net/2008/05/install-postgresql-on-ubuntu-804/ 中的步骤操作.

然后输入命令:

psql template1

我收到以下错误:

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

最佳答案

我的问题是我之前安装了 9.1 版,而 9.1 仍在占用默认端口 5432。我可以使用以下命令找到它:

root@labs:/home/caleb# /etc/init.d/postgresql status
9.1/main (port 5432): down
9.2/main (port 5433): online

所以我能够看到我的 9.2 数据库正在端口 5433 上运行。所以要连接,我必须明确指定端口 5433:

psql -p 5433

关于postgresql - 无法连接到 ubuntu 中的 postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8293635/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com