gcloud alpha sql export sql - exports data from a Cloud SQL instance to a SQL file
gcloud alpha sql export sql INSTANCE URI [--async] [--database=DATABASE,[DATABASE,...], -d DATABASE,[DATABASE,...]] [--offload] [--table=TABLE,[TABLE,...], -t TABLE,[TABLE,...]] [GCLOUD_WIDE_FLAG ...]
(ALPHA) Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a SQL dump file.
NOTE: Certain roles and permissions are required to export data to Google Cloud Storage. For more information on exporting data from Google Cloud SQL see Export from Cloud SQL to a SQL dump file https://cloud.google.com/sql/docs/mysql/import-export/import-export-sql#gcloud.
- INSTANCE
Cloud SQL instance ID.
- URI
The path to the file in Google Cloud Storage where the export will be stored. The URI is in the form gs://bucketName/fileName. If the file already exists, the operation fails. If the filename ends with .gz, the contents are compressed.
- --async
Return immediately, without waiting for the operation in progress to complete.
- --database=DATABASE,[DATABASE,...], -d DATABASE,[DATABASE,...]
Database(s) from which the export is made. Information on requirements can be found here: https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/export#exportContext.databases
- --offload
Offload an export to a temporary instance. Doing so reduces strain on source instances and allows other operations to be performed while the export is in progress.
- --table=TABLE,[TABLE,...], -t TABLE,[TABLE,...]
Tables to export from the specified database. If you specify tables, specify one and only one database. For PostgreSQL instances, only one table can be exported at a time.
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.
This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist. These variants are also available:
$ gcloud sql export sql
$ gcloud beta sql export sql