Skip site navigation (1) Skip section navigation (2)

Re: Creating a db on my newly installed postresql on OS X

From: Søren Krogh Neigaard <soeren(at)neigaard(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Creating a db on my newly installed postresql on OS X
Date: 2010-04-16 18:21:12
Message-ID: 8CBAE862-DCA2-4F26-BCDC-BD86613623C3@neigaard.com (view raw or flat)
Thread:
Lists: pgsql-novice
When I issue the command "psql postgres", I get this message:

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"?

I found a tutorial that told me to do the following:

sudo mkdir -p /opt/local/var/db/postgresql84/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql84/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb'
sudo su postgres
/opt/local/lib/postgresql84/bin/createuser -s -P -l #MYUSER#

But still I get the same error when ever I try and run psql. But how does postgresql know where to find my database files? Or is it something else that is my problem?

Med venlig hilsen/Best regards
Søren Neigaard <soeren(at)neigaard(dot)com>

If I'd known computer science was going to be like this, I'd never have given up being a rock 'n' roll star.

On 16/04/2010, at 19.01, Tom Lane wrote:

> =?iso-8859-1?Q?S=F8ren_Krogh_Neigaard?= <soeren(at)neigaard(dot)com> writes:
>> Im totally new to postgresql. I installed 8.4.3 via MacPorts, and it told me to run this command to have postgresql start at boot:
> 
>> sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql84-server.plist
> 
>> I can see with a ps command that there are something runing. So what next? I can read that I must use initdb to create a database, and give it a path to a file/directory where the data will be stored, but will the running postgresql server then know where this database/data is?
> 
> If the server is running, there must already be a valid data directory
> for it to work in.  I'm not familiar with the MacPorts package but it
> seems likely that that daemon script ran initdb for you --- you could
> look into the script to check.
> 
>> What are the next steps to get me up and running?
> 
> Try "psql postgres" and see what happens.
> 
> 			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2010-04-16 20:08:13
Subject: Re: Creating a db on my newly installed postresql on OS X
Previous:From: Tom LaneDate: 2010-04-16 17:01:34
Subject: Re: Creating a db on my newly installed postresql on OS X

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group