The data directory "/ usr / local / var / postgres" is not owned properly

When I put postgres -D /usr/local/var/postgres in the terminal, I return it back:

FATAL: The data directory "/ usr / local / var / postgres" has incorrect ownership TIP. The server must be started by the user who owns the data directory.

How can i fix this? Thanks ~

+3
homebrew postgresql
source share
1 answer

Verify that the owner of this directory,

 ls -l /usr/local/var/ | grep postgres 

You should see something like

 -rw-r--r-- 1 postgresuser postgresuser 285659 Sep 1 18:05 postgres 

Assuming this is "postgresuser", then start your database with

 sudo -u postgresuser postgres -D /usr/local/var/postgres 
+4
source share

All Articles