Problem with 'postgres' db with 8.0 on a MacBook

Started by Jonathon McKitrickalmost 20 years ago7 messagesgeneral
Jump to latest
#1Jonathon McKitrick
jcm@FreeBSD-uk.eu.org

Hi all,

this is my first time posting here because I've been running pgsql without
problem on a couple of Linux boxes for a while now.

I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
and start a postmaster, any time I try createdb or createuser, I get a message
that the database 'postgres' cannot be found.

I installed after a manual build, chown'ed /usr/local/pgsql to postgres, added
a 'data' directory, and called initdb on it. But all calls to createdb or
createuser gave the message above.

Can anyone help?

Jonathon McKitrick
--
My other computer is your Windows box.

#2Markus Wanner
markus@bluegap.ch
In reply to: Jonathon McKitrick (#1)
Re: Problem with 'postgres' db with 8.0 on a MacBook

Hi Jonathon,

does the following command succeed?

# psql template1 -c "CREATE DATABASE test;"

The database 'postgres' is a system table which has been added in 8.2
(or 8.1 already, dunno). It should exist if you used the correct initdb
and postmaster.

What does psql -l say?

And did you recheck permissions in pg_hba.conf?

BTW: nice laptop, isn't it? Linux still needs some work to run it,
tough. But I'm getting there ;-)

Regards

Markus

Jonathon McKitrick wrote:

Show quoted text

Hi all,

this is my first time posting here because I've been running pgsql without
problem on a couple of Linux boxes for a while now.

I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
and start a postmaster, any time I try createdb or createuser, I get a message
that the database 'postgres' cannot be found.

I installed after a manual build, chown'ed /usr/local/pgsql to postgres, added
a 'data' directory, and called initdb on it. But all calls to createdb or
createuser gave the message above.

Can anyone help?

Jonathon McKitrick
--
My other computer is your Windows box.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jonathon McKitrick (#1)
Re: Problem with 'postgres' db with 8.0 on a MacBook

Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> writes:

I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
and start a postmaster, any time I try createdb or createuser, I get a message
that the database 'postgres' cannot be found.

It sounds to me like you're trying to use PG 8.1 client tools with an
8.0 (or older) postmaster. 8.1 tools expect there to be a 'postgres'
database created by default, but that is not the convention in older
releases. Better check exactly what's laying around already on that
machine. Apple does ship some version of Postgres in OS X IIRC...

regards, tom lane

#4Jonathon McKitrick
jcm@FreeBSD-uk.eu.org
In reply to: Tom Lane (#3)
Re: Problem with 'postgres' db with 8.0 on a MacBook

On Wed, Jun 07, 2006 at 10:31:22AM -0400, Tom Lane wrote:
: Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> writes:
: > I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
: > and start a postmaster, any time I try createdb or createuser, I get a message
: > that the database 'postgres' cannot be found.
:
: It sounds to me like you're trying to use PG 8.1 client tools with an
: 8.0 (or older) postmaster. 8.1 tools expect there to be a 'postgres'
: database created by default, but that is not the convention in older
: releases. Better check exactly what's laying around already on that
: machine. Apple does ship some version of Postgres in OS X IIRC...

That could very well be. I've been installing a couple of versions over one
another, since I couldn't get them to work for various reasons and because gnu
software doesn't have a 'make deinstall'.

How can I remove all the cruft from a previous version?

And where is pg_hba.conf?

Jonathon McKitrick
--
My other computer is your Windows box.

#5Markus Wanner
markus@bluegap.ch
In reply to: Jonathon McKitrick (#1)
Re: Problem with 'postgres' db with 8.0 on a MacBook

Hi Jonathon,

Jonathon McKitrick wrote:

: # psql template1 -c "CREATE DATABASE test;"

CREATE DATABASE

is the result.

Looks good. Can you connect to that database then?

: What does psql -l say?

FATAL: database 'postgres' does not exist

As Tom said: check if you are really calling you self-compiled binaries:

# which pgsql

Markus

#6Shane Ambler
pgsql@007Marketing.com
In reply to: Markus Wanner (#5)
Re: Problem with 'postgres' db with 8.0 on a MacBook

One thing I have noticed with my install (may be something carrying over
from an old version or howto I followed way back) is that the main user is
pgsql but the default db is postgres I find I need to use
#psql -U pgsql -d postgres

By default psql tries to connect to the database of the same name as the
pgsql user you log in as (unless specified with the -U option it will use
the current system username)

You may want to use '-d test' to match the test db you created with the
previous instruction or another that shows in the psql -l list.

On 8/6/2006 3:18, "Markus Schiltknecht" <markus@bluegap.ch> wrote:

Show quoted text

Hi Jonathon,

Jonathon McKitrick wrote:

: # psql template1 -c "CREATE DATABASE test;"

CREATE DATABASE

is the result.

Looks good. Can you connect to that database then?

: What does psql -l say?

FATAL: database 'postgres' does not exist

As Tom said: check if you are really calling you self-compiled binaries:

# which pgsql

Markus

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

#7Jonathon McKitrick
jcm@FreeBSD-uk.eu.org
In reply to: Tom Lane (#3)
Re: Problem with 'postgres' db with 8.0 on a MacBook

Thanks for the help, guys. I've learned from this the importance of keeping a
journal of software installation.

Jonathon McKitrick
--
My other computer is your Windows box.