Verify the hostname and confirm the database exists in the specified cluster.
How do I fix the "Could Not Translate Hostname to Address" error when connecting to PostgreSQL?
Validated on 20 Nov 2024 • Last edited on 6 Dec 2024
A “could not translate hostname to address” error occurs when you use the wrong DNS hostname or there are underlying problems with DNS resolution. The full error message may look like this:
psql: could not translate host name "cluster-do-user-1234567-0.db.ondigitalocean.com"
to address: Name or service not known
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 whether the machine you’re connecting from has problems with DNS resolution by following Why does my domain fail to resolve?
To get started with DNS, see our community tutorial series, An Introduction to Managing DNS, and Retrieve DNS Information with dig
.
Related Topics
Use the command CREATE EXTENSION vector; instead of pgvector.
Add the –no-role-passwords flag to the pg_dumpall command.