PostgreSQL server failed to start, could not create lock file: permission denied

Change the owner of /var/run/postgresql and set it to postgres:

sudo chown -R postgres:postgres /var/run/postgresql

If the user you are running as does not have sudo privilege, then

  1. Change to root:

    su -
    
  2. Change ownership of /var/run/postgresql to user postgres and group postgres:

    chown -R postgres:postgres /var/run/postgresql
    

I had the same problem when installing postgres on Ubuntu 14.04 and changing the ownership fixed the problem for me.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)