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

Re: newbie-problem

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Bernard Reissberg <bernard(dot)reissberg(at)web(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: newbie-problem
Date: 2002-01-30 11:29:39
Message-ID: 1012390182.17978.238.camel@linda (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, 2002-01-30 at 10:28, Bernard Reissberg wrote:
> Hi folks! :-)
> 
> I have a problem with my first steps with postgresql. I installed
> the database-server on my LINUX-box (debian potato) and wanted to
> try out the first operations with psql. When I call psql, I get the
> following error message:
> 
> Connection to database 'template1' failed
> FATAL1: SetUserId: user 'bernard' is not in 'pg_shadow'

When postgresql is first installed, the only user is the user specified
when initdb was run (usually "postgres").  (PostgreSQL users are NOT the
same as system users, though there may be a coincidence of names,
deliberately or otherwise.)

When you call psql, PostgreSQL defaults to a user of the same name as
your system (login) name.  Since that does not yet exist, you have a
failure.

You need to connect to PostgreSQL as user "postgres" and create a
PostgreSQL user "bernard".

$ psql -U postgres template1
  [instead of using "-U postgres" you can define PGUSER=postgres and
export it before calling psql]

template1=# CREATE USER bernard CREATEDB CREATEUSER;
CREATE USER

Alternative method using Unix commands:

$ su - postgres
$ createuser --createdb --adduser bernard

Both these examples give bernard the right to create databases and
create new users.

To begin with, the database has completely open access.  You will need
to edit $PGDATA/pg_hba.conf to define who can connect to the databases
and how they are to be authenticated.

-- 
Oliver Elphick                                Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "The Lord knoweth how to deliver the godly out of 
      temptations, and to reserve the unjust unto the day of
      judgment to be punished;"            II Peter 2:9 

In response to

pgsql-novice by date

Next:From: Oliver ElphickDate: 2002-01-30 11:34:02
Subject: Re: owner of a table
Previous:From: Raphael BauduinDate: 2002-01-30 10:50:29
Subject: owner of a table

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