Re: Error message "psql: could not connect to server: No such file or directory"

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Stefan Schwarzer <stefan(dot)schwarzer(at)unep(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error message "psql: could not connect to server: No such file or directory"
Date: 2012-06-14 14:01:30
Message-ID: 4FD9EEBA.3050008@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/14/2012 06:48 AM, Stefan Schwarzer wrote:
>
>>> Hi there,
>>>
>>> I guess this is a typical user error. I searched around to find the solution, but in vain.
>>>
>>> I just upgraded to Lion, and used Kyngchaos libraries for installation of Postgres.
>>>
>>> Try to get running postgres, and I get this:
>>>
>>> /usr/local/pgsql-9.1/bin/psql -U postgres
>>> psql: could not connect to server: No such file or directory
>>> Is the server running locally and accepting
>>> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
>>>
>>>
>>> In my limited understanding, it seems that Postgres is not running. When I use:
>>>
>>> ps auxw | grep post
>>>
>>> out comes only the "grep post", but no postgres process.
>>>
>>> When I use:
>>>
>>> sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist
>>>
>>> it says:
>>>
>>> org.postgresql.postgres: Already loaded
>>>
>>> and displays in the "ps" list then:
>>>
>>> user 935 0.0 0.1 2493888 7296 ?? Ss 3:24PM 0:00.12 /System/Library/PrivateFrameworks/DiskImages.framework/Resources/diskimages-helper -uuid 9EFB9424-7971-4A8B-9D73-B93BD7F1DB5F -post-exec 4
>>>
>>> (which looks a bit strange to me (DiskImages ??))
>>>
>>>
>>> I am somewhat lost (and worse is that it worked the other day, before re-installing Lion anew.).
>>
>> http://www.kyngchaos.com/software/postgres
>> "
>> Notes
>>
>> NOTE: I've had reports of the installer not initializing the data cluster, which results in Postgres not starting. It seems to be random, and I haven't figured out the cause yet. If Postgres won't start (you get an error "could not connect to server: No such file or directory" when trying to connect with psql), try manually initializing the cluster with:
>> /usr/local/pgsql-9.1/bin/initdb -U postgres \
>> -D /usr/local/pgsql-9.1/data --encoding=UTF8 --locale=en_US"
>> Or see the Locales and Encodings readme if you need a different locale or encoding.
>> Then stop and start Postgres as specified in the read me.
>
> Yeah, I had read that somewhere too, although in my disorientation over the last couple of hours didn't find it anymore. But I did try it out, but got a
>
> "initdb: could not access directory "/usr/local/pgsql-9.1/data": Permission denied"
>
> I guess this is solvable with some "su" access or so. But no idea how. The data directory looks like this:
>
> drwx------ 18 _postgres _postgres 612 Jun 14 14:25 data
>
> So, the user is not anymore "postgres", but "_postgres", right? I read that this changed with Lion, but not sure how this applied to use with Kyngchaos libraries.

I am not an Apple user so all I can do now is point you at the below. Answer 1 would seem to be a solution:

http://stackoverflow.com/questions/6814127/lion-update-removed-the-postgres-user-how-to-restore-it

>
> Thanks a lot for your help!
>
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-06-14 14:25:17 Re: Problem installing extensions on Lion
Previous Message Merlin Moncure 2012-06-14 13:59:34 Re: RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION