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

From: Stefan Schwarzer <stefan(dot)schwarzer(at)unep(dot)org>
To: pgsql-general(at)postgresql(dot)org
Cc: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Subject: Re: Error message "psql: could not connect to server: No such file or directory"
Date: 2012-06-22 06:49:02
Message-ID: F6D31F0C-B68A-4706-99DD-7F9AB6FBBC77@unep.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>
>> When I do: sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist
>> it says: org.postgresql.postgres: Already loaded
>>
>> When I do: /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data --encoding=UTF8 --locale=en_US
>> it says: The files belonging to this database system will be owned by user "xxx".
>> This user must also own the server process.
>> The database cluster will be initialized with locale en_US.
>> The default text search configuration will be set to "english".
>> initdb: could not access directory "/usr/local/pgsql-9.1/data": Permission denied
>
>
> So at a guess user 'xxx' is not '_postgres'. You need to be the _postgres user when doing the initdb.
>
>>
>> Same when using "_postgres" instead of "postgres".
>>
>> When I do: sudo su - _postgres /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data --encoding=UTF8 --locale=en_US
>> it seems to run, but still, same error message "psql: could not connect…."
>
> See, here the initdb worked. Doing the inidtdb is not the same as starting the database. initdb only creates the initial database cluster.
>
> To start the database you need to do something like(as _postgres):
>
> /usr/local/pgsql-9.1/bin/pg_ctl start -D /usr/local/pgsql-9.1/data

Thanks so much for those tips. If I understand it correctly, the commands should be then:

sudo su - _postgres /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data --encoding=UTF8 --locale=en_US
sudo su - _postgres /usr/local/pgsql-9.1/bin/pg_ctl start -D /usr/local/pgsql-9.1/data

Although I don't get an error message, I don't have the feeling that it started the server. There is still nothing in the process list, and a normal "psql" results in the same message as before "psql: could not connect…"

So sorry for bothering you guys… just being really frustrated now…

If you have any ideas, please let me know… :-)

Stef

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2012-06-22 07:19:36 Re: Error message "psql: could not connect to server: No such file or directory"
Previous Message Simon Riggs 2012-06-22 06:27:09 Re: Promoting sync slave to master without incrementing timeline counter?