Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL could not create any TCP/IP sockets' Mavericks

Tags:

I'm installing through brew.

The error message(s):

When I call

postgres 

I receive the error

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

Running

postgres -D /usr/local/var/postgres 

Creates the same error

createdb 

prompts me for my password twice, then says,

createdb: could not connect to database template1: FATAL:  password authentication failed for user "thomasmurphy" 

What I've tried * Uninstalling and reinstalling the pg gem, uninstalling and reinstalling postgres * Updating command line tools * Satisying all of brew doctor's needs * editing pg_hba.conf's permissions * editing .bash_profile to be sure it includes the above directories

I have Postgres running perfectly on my work computer, also on Mavericks, so this strikes me as somewhat of an edge case. What other vectors can I poke at to try to solve this?

like image 904
Thomas Murphy Avatar asked Nov 25 '13 16:11

Thomas Murphy


2 Answers

The error you got is because your host is broken. Check your /etc/hosts file.

Put 127.0.0.1 localhost at the first line of hosts.

like image 188
gpxlcj Avatar answered Sep 17 '22 15:09

gpxlcj


The errors you are getting are because PostgreSQL is running. How do I know? Because it is rejecting your password. That's pretty clear.

Now your real problem is probably that you need to restart PostgreSQL after modifying the pg_hba.conf to give you trust access. Then you can:

 ALTER USER foo WITH PASSWORD 'bar'; 

In terms of starting and restarting PostgreSQL, please see this question: How to start PostgreSQL server on Mac OS X?

like image 34
Chris Travers Avatar answered Sep 21 '22 15:09

Chris Travers