You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在NixOS中使用PostgreSQL遇连接错误,需修改configuration.nix吗?

PostgreSQL连接错误问题求助

我已通过以下命令安装PostgreSQL:

nix-env -iA nixos.postgresql

但使用psql时出现如下错误:

psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

请问是否需要在/etc/nixos/configuration.nix中添加相关配置?

更新

我尝试改用nix-shell而非nix-env的方式安装,操作后仍出现类似错误:

$ nix-shell --pure shell.nix
done
server started

$ psql
psql: error: could not connect to server: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/mnt/c/Users/Pierre-Olivier/nix/psql/.pg/.s.PGSQL.5432"?

内容的提问来源于stack exchange,提问作者Pierre-olivier Gendraud

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 12:05:15