跳到正文
Skillpedia
API 与服务器(后端)33k · #8715

cloud-sql-basics

它能做什么

这个技能帮你的 AI 智能体在 Google Cloud 上设置托管的关系型数据库。适合希望以更少维护工作托管 MySQL、PostgreSQL 或 SQL Server 的开发者。

适用场景

  • ✓当你需要在 Google Cloud 上创建新的 Cloud SQL 数据库实例时。
  • ✓当你想为应用设置密码、创建数据库或获取连接名称时。
  • ✓当你想规划数据库的备份、高可用或安全连接时。

技能链接

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/database/cloud-sql-basics/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/database/cloud-sql-basics/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请为我的应用在 europe-west1 的 Google Cloud 上设置一个 PostgreSQL 数据库。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体运行 gcloud 命令来启用服务、创建实例、添加数据库并设置用户密码。它还会说明如何找到应用所需的连接名称。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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: 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.

常见问题

我需要什么权限?

你需要 Cloud SQL Admin 角色或同等权限,才能创建和管理实例。

它支持哪些数据库?

支持 MySQL、PostgreSQL 和 SQL Server。

Google 会处理更新吗?

会。该服务会自动完成补丁、更新和备份等任务。

详情

作者的原始描述

Creates and manages Cloud SQL instances for MySQL, PostgreSQL, and SQL Server. Handles backups, high availability, and secure connectivity for relational database workloads on Google Cloud.

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#8715
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能