Re: changing the password of postres - Mailing list pgsql-general

From Devrim GUNDUZ
Subject Re: changing the password of postres
Date
Msg-id Pine.LNX.4.61.0409071401410.12570@emo.org.tr
Whole thread Raw
In response to changing the password of postres  (Prabu Subroto <prabu_subroto@yahoo.com>)
Responses Re: changing the password of postres
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Tue, 7 Sep 2004, Prabu Subroto wrote:

> Each time if I want to connect to postgres with
> postgres I do like this:
> "
> patrixlinux@patrix:~> su
> Password:
> patrix:/localhome/patrixlinux # su postgres
> postgres@patrix:/localhome/patrixlinux> cd
> postgres@patrix:~> psql kv
> Welcome to psql 7.4.2, the PostgreSQL interactive
> terminal.

Or you could run this command with "any" user without su:

# psql kv -U postgres

> So now, the user "postgres" still has no password.
> How can I create the password for the user with psql?

ALTER USER will do it.

ALTER USER postgres WITH ENCRYPTED PASSWORD 'yourpassword';
(Don't forget the quotes...)

Also, you must enable password auth:

http://www.postgresql.org/docs/current/static/client-authentication.html
http://www.postgresql.org/docs/current/static/client-authentication.html#EXAMPLE-PG-HBA.CONF

Then reload postgresql...

> How can I create an account and its password with sql
> query from psql?

CREATE USER username WITH ENCRYPTED PASSWORD 'yourpassword';

See \h CREATE USER in psql for details.

> And how can I define that they have
> the privilege to work with a database and some
> tables....?

See the SQL keyword GRANT .

http://www.postgresql.org/docs/7.4/static/sql-grant.html

Regards,
- --
Devrim GUNDUZ
devrim~gunduz.org                devrim.gunduz~linux.org.tr
             http://www.tdmsoft.com
             http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBPZaFtl86P3SPfQ4RAoPXAJsGtWfePMGM6TwQNxHMJNGO/kd81wCfcyiA
KTiehpw329znOng2CgteNc0=
=zOVs
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: Paul Thomas
Date:
Subject: Re: postgres 8 performance
Next
From: Devrim GUNDUZ
Date:
Subject: Re: Help supressing NOTICE messages