Reputation: 103
I am new to this type of database and I try to connect to it through the command line specifying psql, and then entering the password as blank. I get the above error (in the title of this question).
I dont know what the default password.
pg_hba file:
IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication DIMA 127.0.0.1/32 trust
host replication DIMA ::1/128 trust
postgresql.config
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
port = 5432 # (change requires restart)
I restart the server this way:
C:\metasploit\postgresql\bin\pg_ctl -D "C:\metasploit\postgresql\myData" -l logfile start
All I want is to enter the database and change my password. And preferably to enter the PgAdmin-III (in GUI form)
Upvotes: 7
Views: 26482
Reputation: 26464
As Craig said, you probably didn't restart the server and you should use restart instead of start. (reload may work as well but not as sure on Windows)
But that is not your problem. The key problem is almost certainly that you are not connecting to localhost and you have lines in your pg_hba.conf
that are requiring passwords from other hosts.
Note if you connect to an external IP address, you will hit a different or more general rule.
This error means, basically, that the pg_hba.conf
file is set to password authentication but no password was supplied. If you cannot find the problem quickly, what IP address the connection is from should be in the postgresql log file.
As for using trust, you should certainly change it back after changing your password. Ordinarily I would agree with Craig that one should not use trust authentication outside of development, but it is a legitimate approach to password resets of important users, and on Windows, this has to be done in ways supported well on the platform.
As a final note the question is how you are logging in. If you are going to set this, you should probably use psql -h 127.0.0.1 [dbname]
to ensure Windows doesn't do something weird like try to connect using the machine name (and hence external IP).
Upvotes: 0
Reputation: 324541
If you were using trust
authentication (which you should only use for development, if then) you would not be prompted for a password by psql
.
I'd say you didn't properly restart the server. Maybe use restart
instead of start
?
Upvotes: 2