1

After trying to install Postgres using Postgres.app and EnterpriseDB, I decided to re-install it using Homebrew (As I got some problems connecting to database).

PYTHON=/usr/local/bin/python brew install postgresql
initdb -A trust /usr/local/var/postgres
initdb /usr/local/var/postgres -E utf8


mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.3.2/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

I am working to create a database using Postgres. Whenever I try to create database using command line, I got this problem :

MACBOOK:~ macbook$ postgres -D /usr/local/var/postgres

LOG: could not bind IPv6 socket: Address already in use HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. LOG: could not bind IPv4 socket: Address already in use HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. LOG: could not bind IPv6 socket: Address already in use HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. WARNING: could not create listen socket for "localhost" FATAL: could not create any TCP/IP sockets

Or I face this problem

Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

Any ideas to solve this problem?

2
  • Tip: use the {} button to format logs, etc. If you use the quote button (>) they get wrapped and become illegible. Jan 20, 2014 at 2:12
  • Also: If you have a problem with software, installing more software is usually not the best approach. It just makes everything more complicated because you have TWO messes to deal with, not just one. In this case I'd say your old PostgreSQL install is still using port 5432. Jan 20, 2014 at 2:13

1 Answer 1

1

If you want to run more postgres clusters on a single machine, just make sure that they have their own $PGDATA (the location where their data and config files are) and make sure that in their postgres.conf the parameter for port differ.

port = 2345
listen_addresses='*'

the cluster can share the listen_addresses but not the port. So each must have it's own port number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.