Re: Error message "psql: could not connect to server: No such file or directory" - Mailing list pgsql-general

From Stefan Schwarzer
Subject Re: Error message "psql: could not connect to server: No such file or directory"
Date
Msg-id F6D31F0C-B68A-4706-99DD-7F9AB6FBBC77@unep.org
Whole thread Raw
In response to Re: Error message "psql: could not connect to server: No such file or directory"  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Error message "psql: could not connect to server: No such file or directory"
List 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
initialdatabase 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
theprocess 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

pgsql-general by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Promoting sync slave to master without incrementing timeline counter?
Next
From: Stefan Schwarzer
Date:
Subject: Re: Error message "psql: could not connect to server: No such file or directory"