- 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
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-02-06 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{
"last_modified": "Last updated 2024-02-06 UTC.",
"state": ""
}