Thread: psql: FATAL: missing or erroneous pg_hba.conf file
Hi All,
new here, and pgsql in general. I currently use MySQL and now need to know pgsql. I have set it up on my Linux box, CentOS 4-3, using an RPM from Dag Wieer's repos. I am getting the following,
[racket@ibmlap lib]$ psql template1
psql: FATAL: missing or erroneous pg_hba.conf file
HINT: See server log for details.
after following here,
http://polder-linux.org/modules.php?name=News&file=article&sid=182
as I was eperiencing the same problem as the user at the bottom,
Warning: pg_connect() unable to connect to PostgreSQL server: FATAL 1: IDENT authentication failed for user "arjen"
Refer to PostgreSQL Administrator's guide, Chapter 4: Client Authentication.
You probably have this line in the /var/lib/pgsql/data/pg_hba.conf:
local all ident sameuser
(I know RedHat 8.0 does this). You need to change this into:
local all trust
This tells PostgreSQL to allow any UNIX user to log into the database as any database user on a local socket.
*******************
and here,
http://serghei.net/docs/database/pgresql-7.1-admin/client-authentication.html
I'm a little lost. Could someone steer me in the right direction? Cheers.
Mark Sargent.
new here, and pgsql in general. I currently use MySQL and now need to know pgsql. I have set it up on my Linux box, CentOS 4-3, using an RPM from Dag Wieer's repos. I am getting the following,
[racket@ibmlap lib]$ psql template1
psql: FATAL: missing or erroneous pg_hba.conf file
HINT: See server log for details.
after following here,
http://polder-linux.org/modules.php?name=News&file=article&sid=182
as I was eperiencing the same problem as the user at the bottom,
Warning: pg_connect() unable to connect to PostgreSQL server: FATAL 1: IDENT authentication failed for user "arjen"
Refer to PostgreSQL Administrator's guide, Chapter 4: Client Authentication.
You probably have this line in the /var/lib/pgsql/data/pg_hba.conf:
local all ident sameuser
(I know RedHat 8.0 does this). You need to change this into:
local all trust
This tells PostgreSQL to allow any UNIX user to log into the database as any database user on a local socket.
*******************
and here,
http://serghei.net/docs/database/pgresql-7.1-admin/client-authentication.html
I'm a little lost. Could someone steer me in the right direction? Cheers.
Mark Sargent.
Mark,
and what exactly is there in server log?
Reading your words I assume you made a typing error while editing pg_hba.conf
Harald
--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstraße 202b
70197 Stuttgart
0173/9409607
-
PostgreSQL - supported by a community that does not put you on hold
and what exactly is there in server log?
psql: FATAL: missing or erroneous pg_hba.conf file
HINT: See server log for details.
Reading your words I assume you made a typing error while editing pg_hba.conf
Harald
--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstraße 202b
70197 Stuttgart
0173/9409607
-
PostgreSQL - supported by a community that does not put you on hold
Harald Armin Massa wrote: > Mark, > > and what exactly is there in server log? LOG: missing field in file "/var/lib/pgsql/data/pg_hba.conf" at end of line 67 FATAL: missing or erroneous pg_hba.conf file HINT: See server log for details. > psql: FATAL: missing or erroneous pg_hba.conf file > HINT: See server log for details. > > > Reading your words I assume you made a typing error while editing > pg_hba.conf No typo. Thought I'd pasted this in the first post. Sorry about that. # TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only local all trust # IPv4 local connections: host all all 127.0.0.1/32 ident sameuser # IPv6 local connections: host all all ::1/128 ident sameuser Cheers. Mark Sargent.
Mark Sargent <coolboarderguy@gmail.com> writes: > # TYPE DATABASE USER CIDR-ADDRESS METHOD > # "local" is for Unix domain socket connections only > local all trust That's short one "all": you need type, database, user, method columns (but no address column for "local"). regards, tom lane
Tom Lane wrote: >That's short one "all": you need type, database, user, method columns >(but no address column for "local"). > Hi All, yes, Tom, you're correct. Someone mailed me directly(thank you), with a link to their site's tut on authentication, and I picked up on it straight away. Seems the sites I was looking at were wrong. Anyway, I now get this, [racket@ibmlap ~]$ psql template1 psql: FATAL: role "racket" does not exist Log output: LOG: database system is ready LOG: transaction ID wrap limit is 2147484146, limited by database "postgres" FATAL: role "racket" does not exist Which confuses me, as local all all trust should allow me to connect, no? Or, is there a particular syntax when connecting locally? I can't imagie that being so, but then agan, I would have expected this to be a little easier than it has been already. Cheers. Mark Sargent.
Mark Sargent <coolboarderguy@gmail.com> writes: > [racket@ibmlap ~]$ psql template1 > psql: FATAL: role "racket" does not exist > Which confuses me, as local all all trust should allow me to connect, > no? No, it allows you to claim that you are any database user you want to claim you are. The default assumption is that you want to be the database user with the same name as your OS username. The problem here is that there is no such user. Most likely the only pre-existing database user will be named "postgres", so try psql -U postgres template1 If that lets you in, execute the SQL command "CREATE USER racket;" and then you should be able to connect as "yourself". (Note: you might prefer to make yourself a superuser, see the manual.) regards, tom lane