I'm trying to register new server in pgadmin3 with following settings:
Name: postgres
Host: localhost
Username: postgres
Password: <password which works for psql>
Service: empty or postgres
But it shows error:
FATAL: Ident authentification failed for user "postgres"
I've restarted postgresql service, but to no avail.
Contents of /var/lib/pgsql/data/pg_hba.conf:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 ident
EDIT: Tools -> Server Configuration -> pg_hba.conf is greyed out.
The ident authentication method works by obtaining the client's operating system user name from an ident server and using it as the allowed database user name (with an optional user name mapping). This is only supported on TCP/IP connections.
1, the default Postgres database password is postgres . Type the new password for the selected user type. Type the password again to confirm it. Click Save Configuration.
If you don't remember your PostgreSQL database password, you can follow the steps below to reset it to a new value: Change the authentication method in the PostgreSQL configuration file pg_hba. conf from md5 to trust and reload the configuration. You should now be able to connect to PostgreSQL with the new password.
It looks like PgAdmin-III is probably connecting over IPv6 by default, so it's using the ident
line that matches the IPv6 address for localhost, ::1/128
.
If you want to use password authentication, you probably want:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
I'm not sure why you have the unix domain socket line set to trust
, but that's probably OK if it's just a development machine, so leave it unchanged. It's really much safer to have it as ident
(if you want the unix user to have to be the same as the Pg user) or md5
(for password auth on local unix sockets) though.
You'll need to edit pg_hba.conf
directly in a text editor if PgAdmin-III doesn't have permissions to edit it. You could run PgAdmin-III as user postgres
via sudo
, but it's way safer (and probably easier) to just use nano
or a similar command-line text editor to modify pg_hba.conf
.
The password works for psql
because psql
will, unless told otherwise, connect over a unix domain socket, and you have that set to trust
. You'll probably find you could give any password to psql
and it'll still work, because it's never being asked to actually give the password, it's just being automatically trusted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With