FATAL: unable to create lock file "postmaster.pid": permission denied

I get an error

FATAL: could not create lock file "postmaster.pid": Permission denied 

when trying to execute a command

 pg_ctl restart --pgdata "D:\Program Files\PostgreSQL\8.3\data" 

Full rights are set for postgres users for D: \, D: \ Program Files \, D: \ Program Files \ PostgreSQL \ and D: \ Program Files \ PostgreSQL \ 8.3 \ data. What else do I need to do?

+6
source share
3 answers

I set full access to D: \ Program Files \ PostgreSQL \ 8.3 \ data in the Users group, and now it works. Detailed at http://forumserver.twoplustwo.com/114/pokertracker/cant-connect-db-422617/ (last post).

+12
source

You must make sure that the postgres user has the right to write and execute / var / run / postgresql

 sudo chmod 765 /var/run/postgresql sudo chown postgres /var/run/postgresql 

I had this problem due to the installation of postgres-xc and the solution was to remove it.

pg_ctl is the most common (and recommended) way used to start / stop / etc postgres.

For some reason, this was not part of my postgres installation.
After a little pruning duckduckgo, I installed postgre-xc, which includes pg_ctl.
postgres-xc changed the owner of / var / run / postgresql from postgres to postgres-xc.
This caused a lot of headaches and warnings about the inability to lock the pid file.

So, I deleted postgres-xc (and returned the owner of / var / run / postgresql to postgres).

Instead of using pg_ctl, I control postgres using

service postgresql status
or
/etc/init.d/postgresql status .

Hope this helps someone.

+6
source

postgresql service is located in NETWORK SERVICE , therefore it is necessary that the data dir (ie "D:\Program Files\PostgreSQL\8.3\data" ) be fully included in the NETWORK SERVICE group.

+3
source

Source: https://habr.com/ru/post/905582/


All Articles