<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/connecting-to-postgres-with-psql-and-pg-service-conf-p9ygpxfju" -->

---
title: Connecting to Postgres With psql and .pg_service.conf
description: Learn how to connect to Postgres using psql and .pg_service.conf, a configuration file that aliases names with PostgreSQL connection information.
canonical: https://daily.dev/posts/connecting-to-postgres-with-psql-and-pg-service-conf-p9ygpxfju
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Connecting to Postgres With psql and .pg_service.conf | daily.dev
og:description: Learn how to connect to Postgres using psql and .pg_service.conf, a configuration file that aliases names with PostgreSQL connection information.
og:url: https://daily.dev/posts/connecting-to-postgres-with-psql-and-pg-service-conf-p9ygpxfju
og:image: https://api.daily.dev/og/posts/p9ygpXfju.png
og:image:alt: Connecting to Postgres With psql and .pg_service.conf
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting to Postgres With psql and .pg_service.conf

**[TigerData \(Creators of TimescaleDB\)](https://daily.dev/sources/tigerdata)** · 2 min read · 1 upvotes · 0 comments

## Summary

Learn how to connect to Postgres using psql and .pg_service.conf, a configuration file that aliases names with PostgreSQL connection information.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.timescale.com/blog/connecting-to-postgres-with-psql-and-pg_service-conf/>

---

Tags: [#postgresql](https://daily.dev/tags/postgresql), [#timescale](https://daily.dev/tags/timescale)

[View this post on daily.dev](https://daily.dev/posts/connecting-to-postgres-with-psql-and-pg-service-conf-p9ygpxfju)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Connecting to Postgres With psql and .pg_service.conf","url":"https://daily.dev/posts/connecting-to-postgres-with-psql-and-pg-service-conf-p9ygpxfju","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/connecting-to-postgres-with-psql-and-pg-service-conf-p9ygpxfju"},"datePublished":"2024-02-09T12:03:46.222Z","dateModified":"2024-05-09T09:28:18.744Z","description":"Learn how to connect to Postgres using psql and .pg_service.conf, a configuration file that aliases names with PostgreSQL connection information.","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ec1190060dbdf1587efe0159de7cce88?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ec1190060dbdf1587efe0159de7cce88?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"TigerData (Creators of TimescaleDB)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"TigerData (Creators of TimescaleDB)","logo":"https://media.daily.dev/image/upload/s--bsnY3goS--/f_auto/v1756960371/squads/timescale?_a=BAMClqZW0","url":"https://daily.dev/squads/tigerdata"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/connecting-to-postgres-with-psql-and-pg-service-conf-p9ygpxfju","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"postgresql,timescale","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"TigerData (Creators of TimescaleDB)","item":"https://daily.dev/squads/tigerdata"},{"@type":"ListItem","position":3,"name":"Connecting to Postgres With psql and .pg_service.conf"}]}
```

