Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot restart postgres on mac os x [duplicate]

I cannot restart the postgres server on Mac OS X. How can I fix this?

Tried two ways:

pg_ctl restart returns:

pg_ctl: PID file "usr/local/var/postgres:/postmaster.pid" does not exist
Is server running?
starting server anyway
pg_ctl: could not read file "usr/local/var/postgres:/postmaster.opts"

The server does not restart

pg_ctl -D /usr/local/var/postgres restart results in:

   pg_ctl: PID file "/usr/local/var/postgres/postmaster.pid" does not exist
   Is server running?
   starting server anyway
   server starting
   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 "*"
   FATAL:  could not create any TCP/IP sockets
like image 474
user2002858 Avatar asked Oct 02 '13 21:10

user2002858


People also ask

How do I start PostgreSQL on Mac terminal?

`psql` on Terminal To get to the PostgreSQL terminal, open your terminal, start the database services ( brew services start postgresql) , then run psql . Thank you!

Where is postmaster PID?

While the postmaster is running, its PID is stored in the file postmaster. pid in the data directory. This is used to prevent multiple postmaster processes running in the same data directory and can also be used for shutting down the postmaster process.


1 Answers

1 - Your data directory might be wrong. Make sure you use the right path.

2 - If you install more than one postgres, you need to specify which pg_ctl to use.

I installed postgres 9.2 manually, here's how I start it:

/Library/PostgreSQL/9.2/bin/pg_ctl -D /Library/PostgreSQL/9.2/data start

I installed postgres 9.1 via HomeBrew, here's how it gets started:

/usr/local/Cellar/postgresql/9.1.5/bin/pg_ctl -D /usr/local/var/postgres-9.1.5 start
like image 98
Mingyu Avatar answered Sep 17 '22 03:09

Mingyu