Catalog
google/cloud-sql-basics

google

cloud-sql-basics

This file generates or explains Cloud SQL resources. Use this file when the user asks to create a Cloud SQL instance or database for MySQL, PostgreSQL, or SQL Server. Cloud SQL manages third-party MySQL, PostgreSQL, and SQL Server instances as resources in Cloud SQL. For example, when Cloud SQL creates an open-source MySQL instance, the resulting resource is a Cloud SQL for MySQL instance that Google Cloud manages. Cloud SQL handles backups, high availability, and secure connectivity for relational database workloads.

global
0installs0uses~855
v1.0Saved May 2, 2026

Cloud SQL Basics

Cloud SQL is a fully managed relational database service for MySQL, PostgreSQL, and SQL Server. It automates time-consuming tasks like patches, updates, backups, and replicas, while providing high performance and availability for your applications.

Prerequisites

Ensure you have the necessary IAM permissions to create and manage Cloud SQL instances. The Cloud SQL Admin (roles/cloudsql.admin) role provides full access to Cloud SQL resources.

Quick Start (PostgreSQL)

  1. Enable the API:

    gcloud services enable sqladmin.googleapis.com
    
  2. Create an Instance:

    gcloud sql instances create INSTANCE_NAME \
      --database-version=POSTGRES_18 \
      --cpu=2 \
      --memory=7680MiB \
      --region=REGION
    
  3. Set a password for the default user:

    Because this is a Cloud SQL for PostgreSQL instance, the default admin user is postgres:

    gcloud sql users set-password postgres \
      --instance=INSTANCE_NAME --password=PASSWORD
    
  4. Create a database:

    gcloud sql databases create DATABASE_NAME \
      --instance=INSTANCE_NAME
    
  5. Get the instance connection name:

    You need the instance connection name (which is formatted as PROJECT_ID:REGION:INSTANCE_NAME) to connect using the Cloud SQL Auth Proxy. Retrieve it with the following command:

    gcloud sql instances describe INSTANCE_NAME \
      --format="value(connectionName)"
    
  6. Connect to the instance:

    The Cloud SQL Auth Proxy must be running to be able to connect to the instance. In a separate terminal, start the proxy using the connection name:

    ./cloud-sql-proxy INSTANCE_CONNECTION_NAME
    

    With the proxy running, connect using psql in another terminal:

    psql "host=127.0.0.1 port=5432 user=postgres dbname=DATABASE_NAME password=PASSWORD sslmode=disable"
    

Reference Directory

  • Core Concepts: Instance architecture, high availability (HA), and supported database engines.

  • CLI Usage: Essential gcloud sql commands for instance, database, and user management.

  • Client Libraries & Connectors: Connecting to Cloud SQL using Python, Java, Node.js, and Go.

  • MCP Usage: Using the Cloud SQL remote MCP server and Gemini CLI extension.

  • Infrastructure as Code: Terraform configuration for instances, databases, and users.

  • IAM & Security: Predefined roles, SSL/TLS certificates, and Auth Proxy configuration.

If you need product information not found in these references, use the Developer Knowledge MCP server search_documents tool.

Files7
7 files · 24.0 KB

Select a file to preview

Grade adjusted by static analysis guardrails

AI scored this skill as grade B, but static analysis findings capped it to C:

  • Hardcoded credentials or secrets detected in content (max: C)

Overall Score

78/100

Grade

C

Adequate

Safety

82

Quality

78

Clarity

81

Completeness

72

Summary

This skill provides foundational guidance on Google Cloud SQL—a managed relational database service supporting MySQL, PostgreSQL, and SQL Server. It explains core concepts, CLI commands, client library usage, infrastructure-as-code patterns, IAM/security practices, and MCP integration, enabling agents to help users create and manage Cloud SQL instances.

Static Analysis Findings

1 finding

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Credential Exposure
SEC-023Plaintext Password or Secret2x in 2 filesMax: C

Password or secret in plaintext

references/client-library-usage.mdpassword="my-password
references/iac-usage.mdpassword = "changeme

Detected Capabilities

Explain Cloud SQL architecture and supported database enginesProvide gcloud CLI commands for instance, database, and user managementGuide client library setup (Python, Java, Node.js, Go)Document Terraform resource configuration for Cloud SQLDescribe IAM roles, authentication methods, and security best practicesLink to MCP integrations for database automation and SQL executionReference official Google Cloud documentation and APIs

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

create cloud sql instanceset up postgresql databaseconnect to cloud sqlterraform cloud sqlcloud sql authenticationmanaged database setup

Risk Signals

WARNING

Plaintext password in Python example: password="my-password"

references/client-library-usage.md | Line ~30 (Python usage example)
WARNING

Plaintext password in Terraform example: password = "changeme"

references/iac-usage.md | Line ~24 (Terraform user resource)

Referenced Domains

External domains referenced in skill content, detected by static analysis.

cloud.google.comdocs.cloud.google.comgithub.commcp-toolbox.devregistry.terraform.iowww.apache.org

Use Cases

  • Create a Cloud SQL instance (PostgreSQL, MySQL, or SQL Server)
  • Connect to a Cloud SQL database from application code
  • Set up database users and manage authentication
  • Provision Cloud SQL infrastructure using Terraform
  • Configure IAM roles and secure connectivity
  • Troubleshoot Cloud SQL connectivity and operations

Quality Notes

  • ✓ Well-structured with clear sections (Quick Start, Prerequisites, References)
  • ✓ Comprehensive reference directory covers all major topics (CLI, client libraries, IaC, security, MCP)
  • ✓ Includes practical examples for multiple languages and tools (gcloud, Terraform, Python, Java, Node.js, Go)
  • ✓ Security section adequately covers IAM roles, Auth Proxy, encryption, and service accounts
  • ✓ Links to official documentation and external resources for deeper learning
  • ⚠ Example passwords ('my-password', 'changeme') should include disclaimer that these are placeholders and must be replaced with secure values in production
  • ⚠ No explicit note on password management best practices (e.g., use environment variables, secrets managers, IAM authentication instead of static passwords)
  • ⚠ No error handling guidance for common failure scenarios (e.g., connection timeouts, permission errors, instance creation failures)
  • ⚠ MCP section references external GitHub URLs for extensions without explaining what those extensions do or when to use them
  • ⚠ No mention of cost implications or sizing considerations when creating instances
Model: claude-haiku-4-5-20251001Analyzed: May 2, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Add google/cloud-sql-basics to your library

Command Palette

Search for a command to run...