Unanswered: Postgresql server is not asking for a password
I am running a local Postgres Sql Server and I have a database called my_database.
I have also create a new user called 'tester' on that database with password 'test_password' but when I give the command line..
If connection to postgresql is established without prompting for a password, it will be one of the following reasons:
1. There is a file ~/.pgpass with a valid line (database,host,username und password)
In ~/.pgpass you can store connection information so that psql don't ask for a password.
2. Postgres username is identical to operating system username
This works only on local machine by default (See file "pg_hba.conf" below)
In your example postgresql password of "tester" will not be asked for if operating user "tester" starts psql.
3. You have changed the file "pg_hba.conf" in postgresql's DATADIR
The default configuration in "pg_hba.conf" on my server is:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
If "peer" (or other methods) is changed to "trust" no password will be prompted for any user. (WARNING! security risk!)