Postgres 'psql' 命令在 ubuntu 中不起作用

Postgres 'psql' command is not working in ubuntu

我是 psql 新手。在终端。我输入了以下命令

psql -U postgres

我遇到以下错误:

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"?

这方面请哪位大神帮帮我。

拜托,post 这里的相关消息来自:/postgres/server.logpsql --version

如果里面有 server.log 类似的内容,请阅读下一篇。

FATAL: pre-existing shared memory block (key 5432001, ID 65538) is still in use HINT: If you're sure there are no old server processes still running, remove the shared memory block or just delete the file "postmaster.pid".

如果您的 postrgres 中没有关键数据,您可以立即尝试此修复:

  1. /etc/init.d/postgresql stop(如果某些进程运行,尝试和平关闭)
  2. rm /usr/local/var/postgres/postmaster.pid(使用提示,删除)
  3. /etc/init.d/postgresql start(检查)。