我已经在 Ubuntu 21.04 上安装了 postgresql。
当我想将它与psql命令一起使用时,我收到了这个错误:
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
更新 1
我以前有过postgres。今天我尝试使用它,我得到了这个错误,所以我删除了所有关于 postgres usingsudo apt remove postgresql-13 postgresql-client-13 postgresql-client-common postgresql-14 postgresql-client-14 postgresql-common和 install postgres by sudo apt install postgresql.
在教程中,他们安装 postgres 并在没有任何配置的情况下开始使用它,但我不能这样做。
更新 2
命令输出pg_lsclusters:
Ver Cluster Port Status Owner Data directory Log file
13 main 5432 down,binaries_missing postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log
14 main 5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log