此注册表固定版本所收录的最新上游作者日期。

cloud-sql-basics

已同步 v1.0.0 许可证: Apache-2.0 来源: google/skills/skills/cloud/cloud-sql-basics 提交: 99c871e 收录的最新变更:

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.

摘要

用途
说明 Google Cloud 的全代管关系数据库服务如何运行 MySQL、PostgreSQL 与 SQL Server 工作负载,并处理维护、备份、高可用性及安全连接。
使用时机
在规划代管数据库的设置,或查看如何在 Google Cloud 上管理、连接、保护或复原数据库时参考此内容。
输出结果
内容提供 IAM 权限前提、PostgreSQL 设置与连接步骤,以及 CLI、用户端程序库、MCP、Terraform、安全性、备份和灾难复原的参考资料。
上游变更(11 条,最新收录 2026-09-21)
becc4b8 Enforce semantic versioning (MAJOR.MINOR.PATCH) for skills. 在此技能的 metadata 中添加版本号 `1.0.0`。
50eecce Improved accuracy and contents for Cloud SQL basics skills for security, CLI usage, backups and DR configurations and core concepts 扩充 Core Concepts 摘要,纳入 Cloud SQL 版本方案与读取集区,并添加 Disaster Recovery & Backups 参考项目,涵盖备份、PITR、复本、读取集区比较及 Enterprise Plus Advanced DR。
c75b500 Restructure the YAML frontmatter in all SKILL.md files to nest the 'category' field under the 'metadata:' block. The 'category' field is used to organize the skills in the README.md 将 Databases 类别移至 `metadata` 底下,并在多个 Quick Start 代码区块前加入空行。
626910e Update gcloud examples to use --quiet. 更新 `gcloud` 范例,在激活 API、创建运行个体、设置密码、创建数据库及描述运行个体时使用 `--quiet`。
6f0b877 Nests cloud/ skills under a top level skills/ directory 将文件路径从 `cloud/cloud-sql-basics/SKILL.md` 移至 `skills/cloud/cloud-sql-basics/SKILL.md`,内容未变。
9114a94 Flatten skill directories to work with multiple installation tools 将内容未变的技能文件从 `cloud/products/cloud-sql/cloud-sql-basics/SKILL.md` 移至 `cloud/cloud-sql-basics/SKILL.md`。
9fdab90 No public description 将 Quick Start 标题改为明确标示 PostgreSQL。
9b3ff7f No public description 将文档标题从 `Cloud SQL Guide` 改为 `Cloud SQL Basics`。
1b57cb4 No public description 将 frontmatter 中的技能名称从 `cloud-sql` 改为 `cloud-sql-basics`。
c871830 No public description 添加 PostgreSQL 预设 `postgres` 用户说明与查找运行个体连接名称的指令、更新 Auth Proxy 连接指引,并将参考文档链接改为 `references/...`。
2f4998e No public description 添加 Cloud SQL 技能指南初版,包含服务概述、先决条件、PostgreSQL 设置与连接步骤,以及参考文档链接。
npx skills add "lettucebo/Skills#v2.2.0@cloud-sql-basics" --full-depth

⚠ v2.2.0 发布后即可使用

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 --quiet
    
  2. Create an Instance:

    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:

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

    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:

    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:

    ./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: Cloud SQL editions (Enterprise & Enterprise Plus), instance architecture, read pools, 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.

  • Disaster Recovery & Backups: 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.

历史

v1.0.0 mapping-added 99c871e