Skip to content
Posted on:June 26, 2023 at 04:00 PM

Accessing Google Cloud SQL from Local Machine with Cloud SQL Auth Proxy

Accessing Google Cloud SQL from Local Machine with Cloud SQL Auth Proxy

Goal

  • Access the postgres databases in Google Cloud Platform(GCP)‘s Cloud SQL from local machine with psql

Steps

  1. Install Cloud SQL Auth Proxy Client
curl -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.6.0/cloud-sql-proxy.darwin.amd64
chmod +x cloud-sql-proxy
  1. Run the cloud sql proxy with connection string
cloud-sql-proxy onec-dev:us-central1:built-object-service-dev-m1
  1. Connect the database with psql
psql "host=127.0.0.1 port=5432 sslmode=disable dbname= user="

References

Reference: this

Web Analytics