When connecting to PostgreSQL, I get a "Database Does Not Exist" error.

psql: FATAL:  database "defaultdb" does not exist

A Database Does Not Exist error occurs when:

  • You connect to the wrong cluster.
  • You connect to a database that doesn’t exist in your specified cluster.

If you are getting this error:

  • Verify that you are using the correct hostname to connect.
  • Verify that you’ve created the database in your cluster of choice.
Verify that the hostname is correct and whether your local machine has DNS resolution problems.
Check your cluster and username/password combination.
Verify your connection string and add your local machine to the database cluster’s trusted sources.