[英]sudo: unknown user: postgres
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. 我买了一个iMac的老一代产品(带雪豹),该产品已迁移到Lion。 As followed on other StackOverflow topics I added this line on my .bash_profile : 在其他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 ? 我该怎么办 ?
OSX 10.8和10.9中的默认postgres用户应为_postgres
,可以使用sudo -u _postgres
来运行命令
I got this same error ( su: unknown login: postgres
) when trying sudo su - postgres
. 我在尝试sudo su - postgres
时遇到了同样的错误( su: unknown login: postgres
)。 I then managed to log in using sudo psql -U my.username postgres
. 然后,我设法使用sudo psql -U my.username postgres
登录。
I could then create the appropriate users, etc. 然后,我可以创建适当的用户,等等。
Hope that helps. 希望能有所帮助。
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? 附加信息: 如何在Mac OS X上启动PostgreSQL服务器?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.