设置PostgreSQL以便在Mac OS上初次使用

时间:2011-09-08 04:41:08

标签: macos postgresql

我在我的本地mac上安装了PostgreSQL 9,它安装了“SQL Shell(psql).app”,我认为它是服务器的命令shell。我打开了它,但它要求Username [postgres]:。我输入postgres然后它要求输入密码。我按回车键,它出现以下错误:
psql: fe_sendauth: no password supplied

如何登录,更重要的是如何运行createdb等命令?我在普通的终端窗口中尝试了createdb命令,但命令无法识别。

我应该使用Homebrew还是Macports?我没有使用其中任何一个是Mac OS的新手

感谢您的帮助!

2 个答案:

答案 0 :(得分:1)

我有这个问题,从database.yml中删除主机和端口参数为我修复了它:

development:
  adapter: postgresql
  encoding: unicode
  database: my_db
  pool: 5
  host: localhost # remove this line
  port: 5432 # and this one

答案 1 :(得分:0)

如果您的postgres用户没有密码,请设置此env变量:

export PGPASSWORD=
相关问题