gpt4 book ai didi

postgresql - 无法启动 PostgreSQL

转载 作者:行者123 更新时间:2023-11-29 11:22:32 24 4
gpt4 key购买 nike

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

我卸载并安装了 postgresql,但对我没有任何作用。

$ sudo service postgresql start
* Starting PostgreSQL 10 database server
* Failed to issue method call: Unit postgresql@10-main.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql@10-main.service' for details.

systemctl status postgresql
Failed to issue method call: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/systemd1/unit/postgresql_2eservice

$ psql -V
psql (PostgreSQL) 10.4 (Ubuntu 10.4-2.pgdg14.04+1)

最佳答案

这个问题 /var/run/postgresql/.s.PGSQL.5432 是关于权限的,

您是否更改了数据库目录?如果是,那么您需要向 postgres 授予写入和读取权限

sudo chown -R postgres:postgres <directory_path>

or

sudo chmod -R 777 <directory_path>

如果你不能使用远程访问,在 pg_config 上编辑这一行 listen_addresses = 'localhost'listen_addresses = '*'

并在 pg_hba.conf 中插入这一行:

host    all  all  0.0.0.0/0  md5

关于postgresql - 无法启动 PostgreSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51480002/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com