PostgreSQL版本不会更改为默认值

Ben*_*mir 3 postgresql ruby-on-rails-3 postgresql-9.1

Mac OS X Lion 10.7.4

psql --version-> psql(PostgreSQL)9.0.5

我想安装最新版本并运行它的Rails应用程序。

我做

brew install postgresql

it is installed here: /usr/local/Cellar/postgresql/9.1.4  

initdb /usr/local/var/postgres

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Run Code Online (Sandbox Code Playgroud)

我得到:

pg_ctl: another server might be running; trying to start server anyway
Run Code Online (Sandbox Code Playgroud)

运行postgres --version

 -> 9.1.4
Run Code Online (Sandbox Code Playgroud)

邮编-p 5433

 postgres does not know where to find the server configuration file.
 You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
Run Code Online (Sandbox Code Playgroud)

Cra*_*ger 5

编辑/usr/local/var/postgres/postgresql.conf并更改port指令以使用其他端口号,例如5433。然后像以前一样启动新的Pg实例。

现在,您可以通过在Rails配置中指定其他端口来连接到9.1实例。