When connecting to PostgreSQL I get a Could Not Translate Hostname to Address error

psql: could not translate host name "cluster-do-user-1234567-0.db.ondigitalocean.com" to address: Name or service not known

A Could Not Translate Hostname to Address error occurs when:

  • You use the wrong DNS hostname.
  • There are underlying problems with DNS resolution.

If you are getting this error: