0

I installed latest version of PostgreSQL. I tried to start with this command,

bin/pg_ctl start -D testDB 

I got the following error message.

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. WARNING: could not create listen socket for "localhost" FATAL: could not create any TCP/IP sockets

Looks like already installed postgreSQL in ubuntu is occupying this port. I am new to linux. So how do I kill the process which is occupying this port and start my own postgreSQL post master? and how can I make sure that default postgreSQL server does not start when ubuntu is rebooted?

1 Answer 1

0

Check if a postgres cluster is running

$ pg_lsclusters

If an instance is running, the output will look like this:

Version Cluster   Port Status Owner    Data directory                     Log file
9.1     main      5432 online postgres /var/lib/postgresql/9.1/main       /var/log/postgresql/postgresql-9.1-main.log

9.1 is the major version and main the name of the cluster. Change according to your own case in the commands below.

Stop the instance

$ sudo pg_ctlcluster 9.1 main stop

If it doesn't stop due to running transactions:

$ sudo pg_ctlcluster --force 9.1 main stop

Avoid the automatic start at next boot (without uninstalling)

$ sudo echo manual > /etc/postgresql/9.1/main/start.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .