Re: Cant create new users or databases - Mailing list pgsql-general

From AlphaByte
Subject Re: Cant create new users or databases
Date
Msg-id 00091800411700.01149@alphabyte.co.nz
Whole thread Raw
In response to Cant create new users or databases  (AlphaByte <alan@alphabyte.co.nz>)
List pgsql-general
On Sun, 17 Sep 2000, John McKown wrote regarding "Re: [GENERAL] Cant create new users or databases":
>
> Well, now it looks as if you are logged in as "abyte". You need to be
> logged in as "postgres" in order to start the daemon and to do the
> "createuser". Please forgive my faulty memory, but I think that you need
> to do this:
>
> 1) Login as "postgres"

And so the plot thickens. In order to login as postgres you
have to specify the data environment otherwise it says this:

postgres does not know where to find the database system
data.  You must specify the directory that contains the
database system either by specifying the -D invocation
option or by setting the PGDATA environment variable.

Which is what the command I used was supposed to do, ie:

postgres -D /var/lib/pgsql

But I don't know if my syntax is wrong there, but that is
where postmaster.pid is though.

> 2) Issue the following commands at the prompt (starts
the backend): >    export PGDATA=/var/lib/pgsql
>    mkdir -p $PGDATA
>    /usr/bin/initdb --pglib=/var/lib/pgsql --pgdata=/var/lib/pgsql/data
>    /usr/bin/pg_ctl -D $PGDATA -p /usr/bin/postmaster start >/dev/null 2>&1

Should I include all this when I login for the first time
perhaps?

> 3) At this point, the database backend should be up.
> 4) Now issue the commands (you're still logged in as "postgres"!)
>    createuser abyte
> In this command, answer "y" to the two questions about can the user create
> databases & users. This will allow you to use "abyte" as your normal
> PostgreSQL administrator.
> 5) Logoff of "postgres" and login as "abyte"
> 6) Issue the command: "initdb". This will create the "abyte" database with
> no tables in it.
> 7) You should now be able to issue the "pgsql" command and do whatever.
>
> Oh, one thing that I did was (as "root") change the /etc/profile to
> contain the two lines:
>
> export PGLIB=/var/lib/pgsql
> export PGDATA=/var/lib/pgsql/data
>
OK, I'll try that but first I just want to login first.

>
> Oh, you might get more and better information if you also post your
> questions to one of the pgsql-hackers@postgresql.org or the
> psql-general@postgresql.org mailing lists. Feel free to
> continue to email me if you want, but I'm not a real PostgreSQL heavy
> (yet).

Thanks anyway, any help is appreciated at this point :0)

Alan

--
AlphaByte: PO Box 1941, Auckland, New Zealand
Specialising in:Graphic Design, Education and Training,
Technical Documentation, Consulting.
http://www.alphabyte.co.nz

pgsql-general by date:

Previous
From: Neil Conway
Date:
Subject: LOCK TABLE question
Next
From: Peter Eisentraut
Date:
Subject: Re: [ADMIN] libpq errors when makeing postgres 7.0.2...