Thread: createdb: could not connect to database postgres: FATAL: Ident authentication failed for user "root" error

Hi,

i am new to database postgresql.

when i tried creating database using 'createdb', following error occuered.
createdb mydb
createdb: could not connect to database postgres: FATAL:  Ident authentication failed for user "root"

What would be the reason.

Thanks in advance

bijoy

On Saturday 28 March 2009 13:08:27 bijoy wrote:

> Hi,

>

> i am new to database postgresql.

>

> when i tried creating database using 'createdb', following error occuered.

> createdb mydb

> createdb: could not connect to database postgres: FATAL: Ident

> authentication failed for user "root"

>

> What would be the reason.

>

> Thanks in advance

>

> bijoy

Hi,

Root can not run postgres. You must initdb, createdb, pg_ctl etc. as user 'postgres', the database super user and owner, or as some other user who has sufficient rights to do such things.

Best regards,

--

Aarni Ruuhimäki

bijoy <bijoy.franco@gmail.com> writes:
> when i tried creating database using 'createdb', following error occuered.
> createdb mydb
> createdb: could not connect to database postgres: FATAL:  Ident
> authentication failed for user "root"

You didn't say whose packaging of Postgres this is, but it looks like
you're using a setup that has ident authentication selected.  That
means the only user that can get in initially is user "postgres".
(Well, actually, whatever the initial superuser is, but the odds are
just about 100% that it's named "postgres".)  Your first step should
probably be to create a postgres account for your regular userid
(not root), say via

    su - postgres
    createuser joe

If you don't want authentication to work this way, you can change the
setup in pg_hba.conf.  See the manual under "Client Authentication".
If you're the only person using the machine and you're unworried about
someone cracking into it, you could just as well use "trust" mode
and not bother with restrictions.

            regards, tom lane

Hi,

How to find out superuser 'postgres' password. How to change the password

Thanks in advance

Bijoy


On Sat, Mar 28, 2009 at 10:45 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
bijoy <bijoy.franco@gmail.com> writes:
> when i tried creating database using 'createdb', following error occuered.
> createdb mydb
> createdb: could not connect to database postgres: FATAL:  Ident
> authentication failed for user "root"

You didn't say whose packaging of Postgres this is, but it looks like
you're using a setup that has ident authentication selected.  That
means the only user that can get in initially is user "postgres".
(Well, actually, whatever the initial superuser is, but the odds are
just about 100% that it's named "postgres".)  Your first step should
probably be to create a postgres account for your regular userid
(not root), say via

       su - postgres
       createuser joe

If you don't want authentication to work this way, you can change the
setup in pg_hba.conf.  See the manual under "Client Authentication".
If you're the only person using the machine and you're unworried about
someone cracking into it, you could just as well use "trust" mode
and not bother with restrictions.

                       regards, tom lane

> From: bijoy <bijoy.franco@gmail.com>
> Subject: Re: [NOVICE] createdb: could not connect to database postgres: FATAL:  Ident authentication failed for user
"root"error 
> To: pgsql-novice@postgresql.org, "Tom Lane" <tgl@sss.pgh.pa.us>
> Date: Monday, March 30, 2009, 3:57 PM
> Hi,
>
> How to find out superuser 'postgres' password. How
> to change the password
>
> Thanks in advance
>
> Bijoy
>
>
> On Sat, Mar 28, 2009 at 10:45 PM, Tom Lane
> <tgl@sss.pgh.pa.us> wrote:
>
> > bijoy <bijoy.franco@gmail.com> writes:
> > > when i tried creating database using
> 'createdb', following error
> > occuered.
> > > createdb mydb
> > > createdb: could not connect to database postgres:
> FATAL:  Ident
> > > authentication failed for user "root"
> >
> > You didn't say whose packaging of Postgres this
> is, but it looks like
> > you're using a setup that has ident authentication
> selected.  That
> > means the only user that can get in initially is user
> "postgres".
> > (Well, actually, whatever the initial superuser is,
> but the odds are
> > just about 100% that it's named
> "postgres".)  Your first step should
> > probably be to create a postgres account for your
> regular userid
> > (not root), say via
> >
> >        su - postgres
> >        createuser joe
> >
> > If you don't want authentication to work this way,
> you can change the
> > setup in pg_hba.conf.  See the manual under
> "Client Authentication".
> > If you're the only person using the machine and
> you're unworried about
> > someone cracking into it, you could just as well use
> "trust" mode
> > and not bother with restrictions.
> >
> >                        regards, tom lane
> >


the postgres user exist in your OS?
with root account try

#su - postgres

then use the command creatdb




Hi,

I am able to create database, table, etc...
But when i connect database through python program, I need to pass Username and Passwrd along with the function, pgdb.connect().

by default, postgres is created as user. But i couldnt figure out the password for the same

Thanks in advance

Bijoy


On Mon, Mar 30, 2009 at 10:09 PM, Lennin Caro <lennin.caro@yahoo.com> wrote:

> From: bijoy <bijoy.franco@gmail.com>
> Subject: Re: [NOVICE] createdb: could not connect to database postgres: FATAL:  Ident authentication failed for user "root" error
> To: pgsql-novice@postgresql.org, "Tom Lane" <tgl@sss.pgh.pa.us>
> Date: Monday, March 30, 2009, 3:57 PM
> Hi,
>
> How to find out superuser 'postgres' password. How
> to change the password
>
> Thanks in advance
>
> Bijoy
>
>
> On Sat, Mar 28, 2009 at 10:45 PM, Tom Lane
> <tgl@sss.pgh.pa.us> wrote:
>
> > bijoy <bijoy.franco@gmail.com> writes:
> > > when i tried creating database using
> 'createdb', following error
> > occuered.
> > > createdb mydb
> > > createdb: could not connect to database postgres:
> FATAL:  Ident
> > > authentication failed for user "root"
> >
> > You didn't say whose packaging of Postgres this
> is, but it looks like
> > you're using a setup that has ident authentication
> selected.  That
> > means the only user that can get in initially is user
> "postgres".
> > (Well, actually, whatever the initial superuser is,
> but the odds are
> > just about 100% that it's named
> "postgres".)  Your first step should
> > probably be to create a postgres account for your
> regular userid
> > (not root), say via
> >
> >        su - postgres
> >        createuser joe
> >
> > If you don't want authentication to work this way,
> you can change the
> > setup in pg_hba.conf.  See the manual under
> "Client Authentication".
> > If you're the only person using the machine and
> you're unworried about
> > someone cracking into it, you could just as well use
> "trust" mode
> > and not bother with restrictions.
> >
> >                        regards, tom lane
> >


the postgres user exist in your OS?
with root account try

#su - postgres

then use the command creatdb