简体   繁体   中英

Problem with Postgres: "pg_ctl: could not start server"

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

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 .

In windows, look for postgres processes running in background.

To kill with command line, taskkill /f /IM postgres*

I am faced like this problem, when i run CMD as administrator and the command will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM