postgresql 须藤:未知用户:postgres
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16689934/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sudo: unknown user: postgres
提问by user1713964
I'm currently trying to run postgresql (9.3) on my iMac but I have some issues with user postgres and psql connection.
我目前正在尝试在我的 iMac 上运行 postgresql (9.3),但是我在用户 postgres 和 psql 连接方面遇到了一些问题。
I bought an iMac old generation (with snow Leopard) that was migrated to Lion. As followed on other StackOverflow topics I added this line on my .bash_profile :
我买了一台迁移到Lion的iMac老一代(有雪豹)。在其他 StackOverflow 主题中,我在 .bash_profile 中添加了这一行:
export PATH=/Library/PostgreSQL/9.3/bin:/usr/bin:$PATH
When launching pg :
启动 pg 时:
sudo su postgres -c '/Library/PostgreSQL/9.3/bin/pg_ctl -D /Library/PostgreSQL/9.3/data/ -m fast start'
it returns :
它返回:
su: unknown login: postgres
What should I do ?
我该怎么办 ?
回答by chancyWu
The default postgres user in OSX 10.8 & 10.9 should be _postgres
, you can use sudo -u _postgres
to run the command
OSX 10.8 和 10.9 中的默认 postgres 用户应该是_postgres
,您可以使用它sudo -u _postgres
来运行命令
回答by avjaarsveld
I got this same error (su: unknown login: postgres
) when trying sudo su - postgres
. I then managed to log in using sudo psql -U my.username postgres
.
我su: unknown login: postgres
在尝试时遇到了同样的错误 ( ) sudo su - postgres
。然后我设法使用sudo psql -U my.username postgres
.
I could then create the appropriate users, etc.
然后我可以创建适当的用户等。
Hope that helps.
希望有帮助。
回答by Valery Viktorovsky
Try to start from current user:
尝试从当前用户开始:
/Library/PostgreSQL/9.3/bin/pg_ctl -D /Library/PostgreSQL/9.3/data/ -l /usr/local/var/postgres/server.log start
Additional info: How to start PostgreSQL server on Mac OS X?