Fix: psql: error: connection to server at localhost (::1) port 5432 failed: FATAL: database does not exist

Below are some of the steps you can try to resolve this issue.


Step 1: Make sure the database exists

# psql -h localhost -p 5432 -U db-username -d db-database

Step 2: Check the list of Databases that exits

# psql -h localhost -p 5432 -U db-username -l

This will provide you with the list of all the databases, which will help you to know if it does not exist or you have misspelled it.

psql list of all databases

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!