2012-10-14 41 views
3

的Mac OS X獅子10.7.4改變PostgreSQL的版本將不會從默認

的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 

我得到:

pg_ctl: another server might be running; trying to start server anyway 

運行的Postgres --version

-> 9.1.4 

的Postgres -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. 

回答

4

編輯/usr/local/var/postgres/postgresql.conf並更改port指令以使用不同的端口號,如5433。然後像以前一樣開始新的Pg實例。

您現在可以通過在Rails配置中指定不同的端口來連接到9.1實例。

+0

我改變了端口,並再次運行服務器,但它沒有改變。你可以給我一些關於如何做到這一點的細節。 – Benamir

+0

@Beamon ...你是否改變了你的rails設置來連接到'database.yml'中的新端口? –

+0

我甚至沒有連接到9.1.4實例......我將conf文件更改爲端口號#5433並保存後。啓動pg實例不會連接到正確的實例。在我擔心我的database.yml和rails配置之前,我不需要連接到正確的實例嗎? – Benamir