LocalCloud Cloud SQL Local Emulator
Get started
local.cloud — Cloud SQL Local Emulator .md Open tab

Cloud SQL

Cloud SQL is a managed relational database service. LocalCloud exposes supported instance, database, and user APIs with local PostgreSQL and MySQL engines for application tests.

When to use Cloud SQL

Typical uses

Use when your application relies on a relational schema, SQL migrations, and transactions through PostgreSQL or MySQL drivers. Test database and user provisioning alongside application queries.

Examples

  • Relational application backends
  • Database provisioning and migration tests
Databases

Explore another service

View all
Local workflow

Example usage

Install the CLI, start LocalCloud, and export its environment in the same shell. Generated endpoints account for remapped ports.

1. Install and start · shell
curl -fsSL https://local.cloud/install.sh | sh
localcloud start --local-only
# Export GOOGLE_CLOUD_PROJECT and CLOUD_SQL_EMULATOR_HOST
eval "$(localcloud env)"

Provision a database for application tests

  1. Create supported instance metadata, a database, and a user.
  2. Connect the application to the selected local SQL engine.
  3. Apply a migration and verify a fixture query.

Documented workflows

  • Instance/database/user lifecycle; PostgreSQL and on-demand MySQL 8.4
  • Backup/replica administration, restore/import/export management, and upgrade prechecks
  • Development certificate maintenance APIs

Service boundaries

  • Shared installed engines; version labels do not provision separate versions
  • No per-instance database flags; infrastructure settings are metadata
  • No managed backup recovery or replication guarantees
  • Development certificates for local connections; validate production TLS settings in Google Cloud
Try it in your project

Code examples and integrations

Start with the local guides. Official Google Cloud samples may need endpoint changes and can cover features outside the workflows listed here.

Agent testing

Use Cloud SQL with an AI agent

Before the agent changes application logic, have it create local Cloud SQL state, read it back with the project SDK, and note which feature the check covered. That first local call catches accidental production routing and needs no GCP account, service-account key, or billing project.

Configure this repo

Set up this repository to use LocalCloud for local GCP development. First read https://local.cloud/ai/agents.md, then inspect this repo, identify the GCP services and SDK language, configure emulator environment variables, and run the narrowest integration test against localhost. Do not use real GCP credentials or production endpoints.

Production endpoints, auth, IAM, quotas, regional behavior, and final release validation still need the target Google Cloud project.

Agent resources has more prompts and the AGENTS.md template.

Related guides

Desktop view