data directory “/usr/local/var/postgres” has wrong ownership

谁都会走 提交于 2019-12-10 10:12:56

问题


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~


回答1:


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


来源:https://stackoverflow.com/questions/35078217/data-directory-usr-local-var-postgres-has-wrong-ownership

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!