Google ACE Deploying and Implementing a Cloud Solution Practice Question
A company wants to migrate an on-premises MySQL database to Cloud SQL. They need to import an existing SQL dump file stored in a Cloud Storage bucket. Which command should they use?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
gcloud sql import sql my-instance gs://my-bucket/dump.sql --database=mydb
gcloud sql import sql is the correct command to import a SQL dump file into a Cloud SQL instance. The command specifies the instance, the bucket path, and the database name.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
gcloud compute ssh my-instance --command='mysql < dump.sql'
Why it's wrong here
The `gcloud compute ssh` command attempts to establish an SSH session to a Compute Engine VM, but Cloud SQL is a fully managed database service with no SSH endpoint or filesystem access. You cannot connect to a Cloud SQL instance via SSH; instead, you connect using the Cloud SQL Auth proxy, the mysql client with authorized networks, or you use the `gcloud sql import` command to load the dump from Cloud Storage. This command would also require the dump.sql file to be present on the local machine, not in GCS.
- ✓
gcloud sql import sql my-instance gs://my-bucket/dump.sql --database=mydb
Why this is correct
This is the correct command to import a SQL dump file into a Cloud SQL MySQL instance. The `gcloud sql import sql` command takes the instance name, the Cloud Storage URI of the dump, and the `--database` flag to specify the target database. The Cloud SQL instance's service account must have `storage.objectViewer` permission on the bucket, and the database must already exist. This is the supported, asynchronous import method for managed Cloud SQL.
- ✗
gcloud sql databases create mydb --instance=my-instance --import=gs://my-bucket/dump.sql
Why it's wrong here
The `gcloud sql databases create` command only creates a new empty database; it does not import any data. The `--import` flag is not a valid option for the `databases create` subcommand, so the command would fail with a syntax error. To import data, you must use `gcloud sql import sql` on the instance, and if the database does not exist, create it first with `gcloud sql databases create` (without `--import`).
- ✗
gsutil cp gs://my-bucket/dump.sql | mysql -h my-instance -u root -p
Why it's wrong here
`gsutil cp` is designed to copy objects to and from Cloud Storage; it does not stream file contents to stdout, so piping it into a mysql client is not functional. Furthermore, connecting to a Cloud SQL instance by simply specifying `-h my-instance` bypasses the required authentication and authorized network rules, and the mysql client needs to connect via the Cloud SQL Auth proxy or over an authorized network with valid credentials. The correct way to load the dump is to let Cloud SQL read it from GCS using `gcloud sql import sql`.
Go deeper
Related to this question
Learn chapter
Google Cloud Platform Overview
Key term
Cloud SQL
Cloud SQL is a fully managed relational database service that lets you set up, maintain, and scale SQL databases (like MySQL, PostgreSQL, and SQL Server) in the cloud without managing the underlying infrastructure.
Key term
Cloud storage
Cloud storage is a service that lets you save data on remote servers accessed over the internet instead of on your computer's hard drive.
About these practice questions
Courseiva writes every ACE question from scratch — 769 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.