0

Under the postgres user, I tried the psql command and I'm getting this error:

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"

But when I run /usr/local/pgsql/bin/psql, it is working.

Is there anything wrong with my configuration?

4

3 回答 3

4

上述问题似乎与 PostgreSQL 默认端口号有关,

更改 postgresql.conf 文件中的端口号并重新启动数据库服务器。如果您在安装时更改了端口。

(或者)

而不是 psql 输入完整的命令

 "psql -p 5432 -h localhost"
于 2012-09-20T14:21:31.730 回答
1

您也可以包括数据库用户:

psql -U postgres -p 5432 -h localhost

于 2013-05-15T18:25:09.777 回答
0

您是否重新安装了 postgresql-9.6.3 ?

您需要完全卸载 postgresql

sudo apt-get --purge autoremove postgresql*

sudo apt install postgresql-9.6

于 2017-06-12T11:17:36.643 回答