A Database Does Not Exist
error like the following occurs when you try to connect to a database doesn’t exist in your specified cluster or to the wrong cluster:
psql: FATAL: database "defaultdb" does not exist
If you are getting this error, first verify that you are using the correct hostname to connect by following How to Connect to PostgreSQL Database Clusters. Then, verify that you’ve created the database in your cluster of choice by following How to Manage PostgreSQL Users and Databases in a Database Cluster.