Postgresql 致命:无法创建锁定文件“/var/run/postgresql/.s.PGSQL.5432.lock”:权限被拒绝

jer*_*e12 8 postgresql

我尝试启动 postgresql :/usr/pgsql-11/bin/pg_ctl -D appli/postgres/data/ -l logfile start 但我不明白为什么我的日志文件中总是出现此错误:

FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
Run Code Online (Sandbox Code Playgroud)

我尝试更改权限,但总是权限被拒绝:

chown -R postgres:postgres /var/run/postgresql
chmod 755 /var/run/postgresql
Run Code Online (Sandbox Code Playgroud)

jja*_*nes 0

如果您从源代码安装,目录可能应该是“/tmp”。如果您从存储库安装,则附带的启动脚本应该为您处理权限。为什么不使用它而不是自己运行 pg_ctl 呢?