NAME

gcloud sql connect - connects to a Cloud SQL instance

SYNOPSIS

gcloud sql connect INSTANCE [--database=DATABASE, -d DATABASE] [--user=USER, -u USER] [GCLOUD_WIDE_FLAG ...]

DESCRIPTION

Connects to a Cloud SQL instance.

This command temporarily changes the authorized networks for this instance to allow the connection from your IP address.

This command isn't supported for Cloud SQL instances with only private IP addresses.

NOTE: If you're connecting from an IPv6 address, or are constrained by certain organization policies (restrictPublicIP, restrictAuthorizedNetworks), consider running the beta version of this command to avoid error by connecting through the Cloud SQL proxy: gcloud beta sql connect

EXAMPLES

To connect to a Cloud SQL instance, run:

$ gcloud sql connect my-instance --user=root

POSITIONAL ARGUMENTS

INSTANCE

Cloud SQL instance ID.

FLAGS

--database=DATABASE, -d DATABASE

The SQL Server database to connect to.

--user=USER, -u USER

Cloud SQL instance user to connect as.

GCLOUD WIDE FLAGS

These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.

Run $ gcloud help for details.

NOTES

These variants are also available:

$ gcloud alpha sql connect

$ gcloud beta sql connect