Linux command
gcloud-sql-export-sql 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Export database to Cloud Storage
gcloud sql export sql [instance] [gs://bucket/file.sql] --database [db_name]
Export all databases
gcloud sql export sql [instance] [gs://bucket/file.sql]
Export asynchronously
gcloud sql export sql [instance] [gs://bucket/file.sql] --async
说明
gcloud sql export sql exports data from a Cloud SQL instance to a SQL dump file stored in Google Cloud Storage. The command creates a database backup in standard SQL format that can be imported into other database systems or restored to Cloud SQL instances. The tool supports both MySQL and PostgreSQL instances. Exports can target specific databases or tables, or dump all databases at once. The async mode allows long-running exports to continue in the background without blocking the terminal. Offloading exports to read replicas minimizes performance impact on production instances.
参数
- --database _name_
- Database to export.
- --table _name_
- Tables to export.
- --async
- Don't wait for completion.
- --offload
- Offload to replica.
FAQ
What is the gcloud-sql-export-sql command used for?
gcloud sql export sql exports data from a Cloud SQL instance to a SQL dump file stored in Google Cloud Storage. The command creates a database backup in standard SQL format that can be imported into other database systems or restored to Cloud SQL instances. The tool supports both MySQL and PostgreSQL instances. Exports can target specific databases or tables, or dump all databases at once. The async mode allows long-running exports to continue in the background without blocking the terminal. Offloading exports to read replicas minimizes performance impact on production instances.
How do I run a basic gcloud-sql-export-sql example?
Run `gcloud sql export sql [instance] [gs://bucket/file.sql] --database [db_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --database _name_ do in gcloud-sql-export-sql?
Database to export.