LispCast Web Development part 2 JDBC or PostgreSQL login error

Hi,

What I am doing and what I am getting, I have pasted at https://hastebin.com/ulemilabas.rb

The original URL given in the video was causing syntax error. Found this on Wikibooks. This time a different error.

On my terminal,

set PGUSER=toy-user; psql -d webdev -W

asks for the password and logs in fine. But,

psql -U toy-user -d webdev -W

causes FATAL error for authentication failure.

What am I doing wrong?

Thank you in advance,

Guys, found a fix. Posting the answer so this thread can be concluded.

locate pg_hba.conf

in that file, there is a line (#85), that reads

local all postgres peer

Change it to
local all postgres trust

save and exit the file.

At the terminal, do
sudo /etc/init.d/postgresql restart.

Note: if you have more than one version of PostgreSQL installed (I have, thanks to system upgrades), you need to find out which version of PostgreSQL is being connected to through the psql command. This can be done with sudo -u postgres psql -d webdev -W, and once logged in, do show hba_file to locate the file that needs to be edited.