Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

When I put postgres -D /usr/local/var/postgres in terminal, I get this back:

FATAL: data directory "/usr/local/var/postgres" has wrong ownership HINT: The server must be started by the user that owns the data directory.

How could I fix with that? Thanks~

like image 756
Echo0831 Avatar asked Jan 29 '16 06:01

Echo0831


1 Answers

Check the what the owner is of that dir by doing

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 it's "postgresuser", then run your database with

sudo -u postgresuser postgres -D /usr/local/var/postgres
like image 165
14 revs, 12 users 16% Avatar answered Dec 02 '22 12:12

14 revs, 12 users 16%