postgresql - data directory "/usr/local/var/postgres" has wrong ownership -


when put postgres -d /usr/local/var/postgres in terminal, back:

fatal: data directory "/usr/local/var/postgres" has wrong ownership hint: server must started user owns data directory.

how fix that? thanks~

check owner of dir doing

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

you should see

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

assuming it's "postgresuser", run database with

sudo -u postgresuser postgres -d /usr/local/var/postgres 

Comments