Create DB ends with error "FATAL: Ident authentication failed for user "postgres""

Started by Fabricio Pedroso Jorgeover 9 years ago4 messagesgeneral
Jump to latest
#1Fabricio Pedroso Jorge
fpjbito@gmail.com

Hi all,

PostgreSQL version...: 9.5.5
OS...........................: Oracle Linux 6.5 64 bits

I am quite new in the PostgreSQL world and i'm trying to create a new db
with the following sintax, using the "postgres" OS user:

[postgres@vm-ora12 ~]$ createdb -h localhost -p 5432 -U postgres dbdev

*createdb: could not connect to database template1: FATAL: Ident
authentication failed for user "postgres"*

I did the install via YUM, as "root" user using the PostgreSQL repository.
the service is ip and running:

*[root@vm-ora12 ~]# service postgresql-9.5 statuspostgresql-9.5 (pid
18507) is running...*

Why am i getting the above error while trying to create a new database?

Thanks for the attention and help.

--
*Fabrício Pedroso Jorge.*

Administrador de Banco de Dados

certificacaobd.com.br <http://certificacaodb.com.br&gt;

*Resumo Profissional:*
http://br.linkedin.com/in/fabriciojorge

*Contatos:*
+ 55 91 988991116
skype: fabricio.pedroso.jorge
fpjbito@gmail.com

#2Joshua D. Drake
jd@commandprompt.com
In reply to: Fabricio Pedroso Jorge (#1)
Re: Create DB ends with error "FATAL: Ident authentication failed for user "postgres""

On 12/02/2016 09:58 AM, Fabricio Pedroso Jorge wrote:

Hi all,

/[root@vm-ora12 ~]# service postgresql-9.5 status
postgresql-9.5 (pid 18507) is running.../

Why am i getting the above error while trying to create a new database?

See here:

http://stackoverflow.com/questions/2942485/psql-fatal-ident-authentication-failed-for-user-postgres

JD

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Fabricio Pedroso Jorge
fpjbito@gmail.com
In reply to: Joshua D. Drake (#2)
Re: Create DB ends with error "FATAL: Ident authentication failed for user "postgres""

Hi,

thanks for the attention and help.

Actually, my installation didn't create the *".conf"* files. What i have
are the *".conf.sample"*, created at *"/usr/pgsql-9.5/share"* directory, so
i created a copy of the "postgresql.conf" and "pg_hba.conf" and edited as
follows:

*[root@vm-ora12 share]# cat postgresql.confdata_directory =
'/usr/pgsql-9.5/share'hba_file =
'/usr/pgsql-9.5/share/pg_hba.conf'ident_file =
'/usr/pgsql-9.5/share/pg_ident.conf'*

*[root@vm-ora12 share]# cat pg_hba.conflocal all
all trusthost all
all 127.0.0.1/32 <http://127.0.0.1/32&gt; trusthost
all all ::1/128 trusthost all
all 0.0.0.0/0 <http://0.0.0.0/0&gt; md5*

After these changes, i restarted the service and i tryied to to create the
DB, still without success.

Thanks again for the patience.

2016-12-02 15:03 GMT-03:00 Joshua D. Drake <jd@commandprompt.com>:

On 12/02/2016 09:58 AM, Fabricio Pedroso Jorge wrote:

Hi all,

/[root@vm-ora12 ~]# service postgresql-9.5 status

postgresql-9.5 (pid 18507) is running.../

Why am i getting the above error while trying to create a new database?

See here:

http://stackoverflow.com/questions/2942485/psql-fatal-ident-
authentication-failed-for-user-postgres

JD

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.

--
*Fabrício Pedroso Jorge.*

Administrador de Banco de Dados

certificacaobd.com.br <http://certificacaodb.com.br&gt;

*Resumo Profissional:*
http://br.linkedin.com/in/fabriciojorge

*Contatos:*
+ 55 91 988991116
skype: fabricio.pedroso.jorge
fpjbito@gmail.com

#4Fabricio Pedroso Jorge
fpjbito@gmail.com
In reply to: Fabricio Pedroso Jorge (#3)
Re: Create DB ends with error "FATAL: Ident authentication failed for user "postgres""

Hi,

i found out where the config files were. I connected to the postgres
database, executed the "SHOW data_directory" command and edited the correct
"pg_hba.conf". After that, the "createdb" command worked properly.

Thanks for the attention.

2016-12-02 15:29 GMT-03:00 Fabricio Pedroso Jorge <fpjbito@gmail.com>:

Hi,

thanks for the attention and help.

Actually, my installation didn't create the *".conf"* files. What i
have are the *".conf.sample"*, created at *"/usr/pgsql-9.5/share"*
directory, so i created a copy of the "postgresql.conf" and "pg_hba.conf"
and edited as follows:

*[root@vm-ora12 share]# cat postgresql.confdata_directory =
'/usr/pgsql-9.5/share'hba_file =
'/usr/pgsql-9.5/share/pg_hba.conf'ident_file =
'/usr/pgsql-9.5/share/pg_ident.conf'*

*[root@vm-ora12 share]# cat pg_hba.conflocal all
all trusthost all
all 127.0.0.1/32 <http://127.0.0.1/32&gt; trusthost
all all ::1/128 trusthost all
all 0.0.0.0/0 <http://0.0.0.0/0&gt; md5*

After these changes, i restarted the service and i tryied to to create the
DB, still without success.

Thanks again for the patience.

2016-12-02 15:03 GMT-03:00 Joshua D. Drake <jd@commandprompt.com>:

On 12/02/2016 09:58 AM, Fabricio Pedroso Jorge wrote:

Hi all,

/[root@vm-ora12 ~]# service postgresql-9.5 status

postgresql-9.5 (pid 18507) is running.../

Why am i getting the above error while trying to create a new database?

See here:

http://stackoverflow.com/questions/2942485/psql-fatal-ident-
authentication-failed-for-user-postgres

JD

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.

--
*Fabrício Pedroso Jorge.*

Administrador de Banco de Dados

certificacaobd.com.br <http://certificacaodb.com.br&gt;

*Resumo Profissional:*
http://br.linkedin.com/in/fabriciojorge

*Contatos:*
+ 55 91 988991116 <+55%2091%2098899-1116>
skype: fabricio.pedroso.jorge
fpjbito@gmail.com

--
*Fabrício Pedroso Jorge.*

Administrador de Banco de Dados

certificacaobd.com.br <http://certificacaodb.com.br&gt;

*Resumo Profissional:*
http://br.linkedin.com/in/fabriciojorge

*Contatos:*
+ 55 91 988991116
skype: fabricio.pedroso.jorge
fpjbito@gmail.com