Re: Permission Problems:-)? - Mailing list pgsql-general

From Tom Lane
Subject Re: Permission Problems:-)?
Date
Msg-id 22898.1075221674@sss.pgh.pa.us
Whole thread Raw
In response to Permission Problems:-)?  (Jerome Lyles <susemail@hawaii.rr.com>)
Responses Re: Permission Problems:-)?
List pgsql-general
Jerome Lyles <susemail@hawaii.rr.com> writes:
> I'm trying to build a database.  But none of the users I try to use works.

I think you are confused about the distinction between Postgres users
and Unix users.  The set of user names known to the database doesn't
necessarily have anything to do with the set of login names available on
the local system.  (If you think about cases where the database is used
by remote users, you'll see why this is a good idea.)  If you want to
use database user names that match up with local user names, you have to
specifically create those database user names with the createuser
script.  Initially the only user name known to the database is the
"superuser", who has the right to create more database users.

Now in order to use createuser you need to connect as the database
superuser, which seems to be a tad messed up in itself:

> I as postgresql user doesn't work:
> :~> createdb mydb
> createdb: could not connect to database template1: FATAL:  user "mypostgre"
> does not exist

The name given to the initial database superuser is the name of the
account that ran initdb.  It kinda looks like you changed your mind
about the name of the account owning the postgres installation --- you
seem now to be trying to connect as "mypostgre" but the database has no
such username.  If you remember what you used before, you can try
    createuser -U oldnamehere mypostgre
and be sure to give mypostgre all permissions that createuser asks
about.  Then mypostgre will be a second superuser and you can use that
account to create more users.  If you don't remember what it was before,
you may be reduced to blowing away the old installation and making a new
one (stop postmaster, rm -rf old data dir, initdb, start postmaster).

> I can only start postgresql as root.

I don't think so --- the postmaster will actively refuse to start if you
try to run it as root.  Better take another look at exactly what's
happening.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Reloading Template1
Next
From: Tom Lane
Date:
Subject: Re: Increase stored proc. parameters max count