On a server I'm able to connect to Postgresql via the terminal:
$ psql -U me123 -d my_db
psql (9.4.7)
Type "help" for help.
my_db=# \q
Note that it didn't ask me for the password for some reason even when I provided -p
.
Here's my config:
$ sudo cat /etc/postgresql/9.4/main/pg_hba.conf
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
And I believe because of that, I'm unable to connect to it from my web app on the same server via login and password and the error is (invalid_password): password authentication failed for user "me123"
but the password is valid.
Add
to allow external acces to your server.