Cloud Sql Basics

作者 google55b4e13eba6d无许可证21K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

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.

精选仅含说明DevOps & Cloud
AI 生成的概览

讲解并生成适用于 MySQL、PostgreSQL 和 SQL Server 的 Google Cloud SQL 资源。

功能
该技能提供创建和管理 Cloud SQL 实例、数据库与用户的说明和参考资料。内容涵盖 gcloud CLI 快速入门、通过 Cloud SQL Auth Proxy 连接、IAM 角色、客户端库、Terraform、MCP 用法以及备份和灾难恢复主题。它产出的是指导说明和命令示例,而不是文件或脚本。
适用场景
当用户要求创建或讲解适用于 MySQL、PostgreSQL 或 SQL Server 的 Cloud SQL 实例或数据库时使用。它也适用于有关 Cloud SQL 连接、IAM 权限、备份、高可用性或基础设施即代码的问题。
运行要求
需要具备 Cloud SQL Admin IAM 权限的 Google Cloud 访问权限、gcloud CLI,以及用于连接的 Cloud SQL Auth Proxy。参考资料还涉及客户端库、Terraform 和 MCP 用法。不附带脚本,仅为说明和参考资料。

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:

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

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

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

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

    bash
    gcloud sql databases create DATABASE_NAME \  --instance=INSTANCE_NAME \  --quiet
  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:

    bash
    gcloud sql instances describe INSTANCE_NAME \  --format="value(connectionName)" \  --quiet
  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:

    bash
    ./cloud-sql-proxy INSTANCE_CONNECTION_NAME

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

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

Reference Directory

  • Core Concepts [blocked]: Cloud SQL editions (Enterprise & Enterprise Plus), instance architecture, read pools, high availability (HA), and supported database engines.

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

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

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

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

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

  • Disaster Recovery & Backups [blocked]: Backup types, Point-in-Time Recovery (PITR), replicas, read pools comparison, and Enterprise Plus Advanced DR.

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

来源与署名

来源:google/skills位于skills/cloud/cloud-sql-basics提交55b4e13

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架

更多来自 google/skills 的技能