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\8.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?
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).
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:
chmod u+w /var/lib/postgresql/9.5/main/
You have to make ensure that the user postgres
has right to write & execute /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.
pg_ctl is the most common (and recommended) way used to start/stop/etc 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.
So, I removed postgres-xc (and reverted 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
.
Hopefully this will help someone.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With