目前我没有postgres用户。
~$ sudo su - postgres Password: su: unknown login: postgres
所以,我按照这些说明作为postgres http://www.sd-kyber.com/library/onlineNotes/psqlOSX.html的快速入门,但是在步骤5 ,他们在哪里创build用户,他们引用了页面http://developer.apple.com/internet/opensource/postgres.html ,这是一个断开的链接。
什么是创buildpostgres用户的步骤? 另一个问题,为什么postgres需要有一个postgres用户? 其他数据库系统是否也需要它?
Lion的确有一个postgres用户(甚至是一个postgres组),但是它的名字有一个“_”前缀(就像最新版本的OS X中的大多数系统账户一样):
$ id _postgres uid=216(_postgres) gid=216(_postgres) groups=216(_postgres),12(everyone),61(localaccounts)
Postgres需要一个用户,因为在Unix中,出于安全原因,所有服务通常都有自己的用户。 如果违反,就限制了接pipe整个系统的可能性。
现在,OSX Lion带有PgSQL标准,所以没有理由安装它。
可以在/usr/bin/psqlfind二进制文件,或者在cmd中inputpsql -d postgres -U postgres
如果失败了,并且您已经将您的系统从Snow Leopard更新为Lion:
堆栈溢出:
这是一个PATH问题。 Mac OSX Lion现在在系统中包含Postgresql。 如果你做了一个psql,你可能会看到usr / bin / psql,而不是usr / local / bin / psql,这是HomeBrew的正确的。 如果您运行brew医生,您应该会收到一条消息,指出您需要将usr / local / bin添加到PATH envvariables的头部。
编辑你的.bash_profile或.profile,或者你正在使用的shell,并添加:export PATH = / usr / local / bin:$ PATH
作为PATH的第一个输出,然后要么退出你的shell会话或源文件源〜/ .bash_profile,它现在应该再次确定。
您也可以编辑/ etc /path并确保/ usr / local / bin在最上面。
如果由于其他原因,您仍然想添加一个用户:
# dscl / -create /Users/portingunix # dscl / -create /Users/portingunix UserShell /bin/bash # dscl / -create /Users/portingunix RealName "Porting Unix # dscl / -create /Users/portingunix UniqueID 503 # dscl / -create /Users/portingunix PrimaryGroupID 1000 # dscl / -create /Users/portingunix NFSHomeDirectory /Local/Users/portingunix # passwd portingunix