简体   繁体   中英

Starting Postgres Server

I've had no luck in starting the postgres server. I can add new databases, tables, etc to the postgres from the terminal, but can't add things to the tables through a webpage. The webpage is running on a localhost for now.

The postgres data folder was originally created in a root user, but I moved it to my own user account and it solved many problems, but I'm back at the same old error I keep getting after entering postgres -D data (data being the data cluster folder)

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

I tried two different commands to start the server.

pg_ctl -D data -l logfile start 

which gave me this, but it's not correct

server starting

and

pg_ctl -D /Library/PostgreSQL/9.4/data -l log file start

which gave me this

LOG:  skipping missing configuration file "/Library/PostgreSQL/9.4/data/postgresql.auto.conf"
pg_ctl: another server might be running; trying to start server anyway
server starting

The postgresql.auto.conf file is most definitely there with correct name and everything. If I try to stop the supposedly started server it results in this with the first one from the first command I tried and the second stop with the second command.

Is server running?

and

LOG:  skipping missing configuration file "/Library/PostgreSQL/9.4/data/postgresql.auto.conf"
pg_ctl: could not send stop signal (PID: 83): Operation not permitted

Something seems to already use port 5432 .

Try to find out, which program (maybe another instance of postgres) is blocking that port and decide whether to stop that other process, or not.

As an alternative reconfigure postgres to use other ports.

Maybe you can find out, what is blocking that port by typing this into the console:

lsof -n -i4TCP:5432 | grep LISTEN

Its clear that there is another instance of postgres running. You have to stop that one before starting yours manually as this will go in conflict with the port numbers.

sudo launchctl stop com.edb.launchd.postgresql-9.4

The try and launch with your command.

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