Обсуждение: pgsql initial superuser

Поиск
Список
Период
Сортировка

pgsql initial superuser

От
Pedro Almeida
Дата:
Hello. this is my "first" time using pgsql, and I seem to be running to
a bit of a corner here :-)

I've understood how to add a superuser/database-user/user but I have no
user to begin with.

~# createuser superuser
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
psql: FATAL:  user "root" does not exist
createuser: creation of user "superuser" failed

So I need someway to add a user so I can add others. I belive this is
done in the pg_hba.conf file, but so far I've been unlucky. I'm using
the debian distributed pg_hba.conf file set up for local access, and I
tried the following lines, each a complete failure:

pg_hba.conf
<snip>
local all root md5
#OR
#local all root ident
<snip>

Even with "createuser blabla -Uroot -W" and using the "ident" auth
method fails. What am I missing here?

Thank you for the support :-D


Re: pgsql initial superuser

От
Pedro Almeida
Дата:
kaolin fire wrote:

> try user 'pgsql' :) that's the default initially created superuser, no
> password (it would be good to give it one).
>
> -kaolin fire
> -http://erif.org/code/fallingup/ for a 'spin' on tetris
>
>
That was a quick response :-)

using a clean pg_hba.conf file (no user lines added), this is what happened:

*******
~# createuser -Upgsql
Enter name of user to add: blabla
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
psql: FATAL:  IDENT authentication failed for user "pgsql"

createuser: creation of user "blabla" failed
*******

What am I doing wrong ?

Re: pgsql initial superuser

От
Peter Eisentraut
Дата:
Pedro Almeida wrote:
> So I need someway to add a user so I can add others.

There should be a predefined user named "postgres".


Re: pgsql initial superuser

От
Gémes Géza
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pedro Almeida írta:
| kaolin fire wrote:
|
|> try user 'pgsql' :) that's the default initially created superuser, no
|> password (it would be good to give it one).
|>
|> -kaolin fire
|> -http://erif.org/code/fallingup/ for a 'spin' on tetris
|>
|>
| That was a quick response :-)
|
| using a clean pg_hba.conf file (no user lines added), this is what
| happened:
|
| *******
| ~# createuser -Upgsql
| Enter name of user to add: blabla
| Shall the new user be allowed to create databases? (y/n) n
| Shall the new user be allowed to create more new users? (y/n) n
| psql: FATAL:  IDENT authentication failed for user "pgsql"
|
| createuser: creation of user "blabla" failed
| *******
|
| What am I doing wrong ?
|
| ---------------------------(end of broadcast)---------------------------
| TIP 9: the planner will ignore your desire to choose an index scan if your
|      joining column's datatypes do not match

Add a line:
local  all     all     ident   sameuser
to your pg_hba.conf
restart postgresql
find out under what userid is your postgresql running typicaly it would
be postgres, I'll supose that it is postgres:
su postgres
and do whatever you like with your database cluster.
Because of this I would suggest as a first step to do:
psql template1
SQL commands follow:
ALTER USER postgres password='SomeReallyBigSecretHere' ;

Hope it helps.

Cheers,

Geza
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAMR6G/PxuIn+i1pIRAoaAAKCBALjM0r1nQ3K8anMwrDh/BGscOgCggs18
V+YlMMBEGys7jd7LzfV5M0Y=
=udMf
-----END PGP SIGNATURE-----


Re: pgsql initial superuser

От
Pedro Almeida
Дата:
That was it - user 'postgres', owner of postmaster, has got what it takes.

Thank you for solving my problem and giving me some extra tips to work on.

I will now continue lurking on the ML and watching closely your
discussions. Good bye then :-)



Re: pgsql initial superuser

От
"V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Дата:
Dear Pedro ,

> Hello. this is my "first" time using pgsql, and I seem to be running
> to a bit of a corner here :-)
>
> I've understood how to add a superuser/database-user/user but I have
> no user to begin with.
>
> ~# createuser superuser
> Shall the new user be allowed to create databases? (y/n) y
> Shall the new user be allowed to create more new users? (y/n) y
> psql: FATAL:  user "root" does not exist
> createuser: creation of user "superuser" failed
>

If you have compiled PostgreSQL then the user login  used for initdb is
the default user
else
this was from  rpm then postgres  is the super user
you may login as

psql -U postgres template1

--
Regards,
Vishal Kashyap
Director / Lead Software Developer,
Sai Hertz And Control Systems Pvt Ltd,
http://saihertz.rediffblogs.com
Jabber IM: vishalkashyap[ a t ]jabber.org
ICQ :      264360076
Yahoo  IM: mailforvishal[ a t ]yahoo.com
-----------------------------------------------
You yourself, as much as anybody in the entire
universe, deserve your love and affection.
- Buddha
---------------
pgsql=# select marital_status from vishals_life;

marital_status
------------------
Single not looking

1 Row(s) affected