A developer needs to quickly inspect the contents of a Cloud SQL for MySQL database named "sales" that is running in the project. The developer is working from Cloud Shell and wants an interactive SQL prompt to issue ad-hoc SELECT queries without leaving the browser. Which approach meets the requirement using built-in tools and the least amount of setup?
Issue a bq query command with the Cloud SQL connection string and embed the SELECT statement as text.
Create a Cloud Run job that mounts the Cloud SQL connection via a connector and runs the mysql client inside the container.
Execute gcloud sql connect sales-mysql --user=appuser --database=sales in Cloud Shell and enter the password when prompted.
SSH into a private VM on the same VPC, install the mysql client manually, and connect to the instance's private IP address.
Running the gcloud sql connect command from Cloud Shell automatically starts the Cloud SQL Auth Proxy in the background, opens the MySQL client, and connects over a secure tunnel. Supplying the instance name and the --database flag drops the user into an interactive prompt where standard SELECT statements can be executed. Other options either require additional configuration (private VM with a mysql client, Cloud Run job) or are intended for BigQuery, not Cloud SQL.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is `gcloud sql connect`?
Open an interactive chat with Bash
What is the Cloud SQL Auth Proxy, and why is it used?
Open an interactive chat with Bash
Why is Cloud Shell used for database queries in this scenario?
Open an interactive chat with Bash
What is the `gcloud sql connect` command used for?
Open an interactive chat with Bash
What is the Cloud SQL Auth Proxy and how does it work?
Open an interactive chat with Bash
Why is Cloud Shell recommended for database connection in this scenario?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Ensuring successful operation of a cloud solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .