无法在 Ubuntu 终端上使用 postgresql,出现错误

无法在 Ubuntu 终端上使用 postgresql,出现错误

psql已成功安装在我的 Linux 环境(Ubuntu)上,但使用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 "/var/run/postgresql/.s.PGSQL.5432"?

我已经尝试过以前的解决方案,但没有一个有效。服务器状态也未显示,日志文件为空,并且某些命令要求输入我从未设置的密码。

输出为dkpg -l | grep postgres

ii  postgresql                     12+214                            all          object-relational SQL database (supported version)
ii  postgresql-12                  12.2-4                            amd64        object-relational SQL database, version 12 server
ii  postgresql-client-12           12.2-4                            amd64        front-end programs for PostgreSQL 12
ii  postgresql-client-common       214                               all          manager for multiple PostgreSQL client versions
ii  postgresql-common              214                               all          PostgreSQL database-cluster manager
ii  postgresql-contrib             12+214                            all          additional facilities for PostgreSQL (supported version)

相关内容