1
votes

When I execute command:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

I get this error:

pg_ctl: another server might be running; trying to start server anyway
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output

My postgres started:

brew services start postgresql

1
So what's in the server log? - a_horse_with_no_name

1 Answers

2
votes

You should proceed like this:

  1. Look at /usr/local/var/postgres/postmaster.pid. In the first line, you will find a process ID.

  2. Look if there is a process running with the process ID found in the first step.

    • If yes, check if it is a PostgreSQL process.

      • If yes, then your server is already running.

      • if not, remove postmaster.pid (but never, ever remove that file if the process ID belongs to a PostgreSQL process). Then start PostgreSQL like indicated in the next step.

    • If not, start PostgreSQL again like you did, but add -t 1000 to pg_ctl.