postgresql 致命:无法创建锁定文件“postmaster.pid”:权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8798134/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
FATAL: could not create lock file "postmaster.pid": Permission denied
提问by DSblizzard
I receive error
我收到错误
FATAL: could not create lock file "postmaster.pid": Permission denied
when trying to execute command
尝试执行命令时
pg_ctl restart --pgdata "D:\Program Files\PostgreSQL.3\data"
Full rights for postgres user to D:\, D:\Program Files\, D:\Program Files\PostgreSQL\ and D:\Program Files\PostgreSQL\8.3\data are set. What else I need to do?
postgres 用户对 D:\、D:\Program Files\、D:\Program Files\PostgreSQL\ 和 D:\Program Files\PostgreSQL\8.3\data 的完全权限被设置。我还需要做什么?
回答by DSblizzard
I set full access to D:\Program Files\PostgreSQL\8.3\data to Users group and now it works. Detail are at http://forumserver.twoplustwo.com/114/pokertracker/cant-connect-db-422617/(last post).
我将 D:\Program Files\PostgreSQL\8.3\data 的完全访问权限设置为 Users 组,现在它可以工作了。一个细节都在 http://forumserver.twoplustwo.com/114/pokertracker/cant-connect-db-422617/(最后一篇)。
回答by Gelberth Amarillo Rojas
You need to ensure that the user postgres has write permission to the postgres data_directory configured in postgresql.conf file. In my case /var/lib/postgresql/9.5/main/
if not add permission with:
您需要确保用户 postgres 对 postgresql.conf 文件中配置的 postgres data_directory 具有写入权限。在我的情况下,/var/lib/postgresql/9.5/main/
如果没有添加权限:
chmod u+w /var/lib/postgresql/9.5/main/
回答by SamGoody
You have to make ensure that the user postgres
has right to write & execute /var/run/postgresql
您必须确保用户postgres
有权编写和执行 /var/run/postgresql
sudo chmod 765 /var/run/postgresql
sudo chown postgres /var/run/postgresql
I had this issue due to installing postgres-xc and the solution was to remove it.
由于安装了 postgres-xc,我遇到了这个问题,解决方案是将其删除。
pg_ctl is the most common (and recommended) way used to start/stop/etc postgres.
pg_ctl 是用于启动/停止/等 postgres 的最常用(也是推荐)的方式。
For some reason it was not part of my postgres install.
After duckduckgo'ing a little, I installed postgre-xc which includes pg_ctl.
postgres-xc changed the owner of /var/run/postgresql from postgres to postgres-xc.
This caused lots of headaches and warnings about being unable to lock the pid file.
出于某种原因,它不是我的 postgres 安装的一部分。
在duckduckgo'ing 之后,我安装了包含pg_ctl 的postgre-xc。
postgres-xc 将 /var/run/postgresql 的所有者从 postgres 更改为 postgres-xc。
这引起了很多关于无法锁定 pid 文件的头痛和警告。
So, I removed postgres-xc (and reverted the owner of /var/run/postgresql to postgres).
因此,我删除了 postgres-xc(并将 /var/run/postgresql 的所有者恢复为 postgres)。
Instead of using pg_ctl, I control postgres using
我没有使用 pg_ctl,而是使用控制 postgres
service postgresql status
or/etc/init.d/postgresql status
.
service postgresql status
或/etc/init.d/postgresql status
。
Hopefully this will help someone.
希望这会帮助某人。
回答by Zhengkun Gong
postgresql service
is logined in NETWORK SERVICE
, so you must needed make data dir(ie: "D:\Program Files\PostgreSQL\8.3\data"
) is full control over to NETWORK SERVICE
group.
postgresql service
已登录NETWORK SERVICE
,因此您必须需要使数据目录(即:)"D:\Program Files\PostgreSQL\8.3\data"
完全控制到NETWORK SERVICE
组。