Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgresql version won't change from default

mac os x lion 10.7.4

psql --version -> psql (PostgreSQL) 9.0.5

I want to install latest version and run my rails app with it.

I do

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

I get:

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

running 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.
like image 954
Benamir Avatar asked Oct 14 '12 04:10

Benamir


People also ask

How do I set which PostgreSQL version is to be used by default?

Alternatively, you can set the PGPORT environment variable to the port number of the desired default server. That should affect all applications using the PostgreSQL client library. To list the contents of each database cluster use psql -l -p PORT_NUMBER .


1 Answers

Edit /usr/local/var/postgres/postgresql.conf and change the port directive to use a different port number like 5433. Then start the new Pg instance as you did before.

You can now connect to the 9.1 instance by specifying a different port in your Rails configuration.

like image 78
Craig Ringer Avatar answered Nov 15 '22 05:11

Craig Ringer