After installing cloudsqlctl, you need to configure it to work with your Google Cloud environment.
The easiest way to configure the tool is to run the interactive setup wizard:
cloudsqlctl setupThis wizard will guide you through:
- Checking Prerequisites: Verifies
gcloudis installed. - Authentication: Helps you login to Google Cloud (
gcloud auth login) and set up Application Default Credentials (gcloud auth application-default login). - Project Selection: Lets you select the active Google Cloud project.
- Proxy Installation: Downloads the Cloud SQL Auth Proxy binary if it's missing.
If you prefer to configure things manually or need to change settings later:
Manage your authentication state using the auth command:
# Check current auth status
cloudsqlctl auth status
# Login to gcloud
cloudsqlctl auth login
# Set up Application Default Credentials (ADC) - Required for the proxy
cloudsqlctl auth adc
# Manage Service Account keys
cloudsqlctl auth list-keys
cloudsqlctl auth select-keyTo tell the proxy which database to connect to:
# List available instances in your project
cloudsqlctl list
# Interactively select an instance
cloudsqlctl selectThe tool manages several environment variables for you. You can view them with:
cloudsqlctl envKey variables:
CLOUDSQLCTL_HOME: Configuration directory (default:~/.cloudsqlctl)CLOUDSQLCTL_LOGS: Log directoryCLOUDSQLCTL_PROXY_PATH: Path to thecloud-sql-proxyexecutable
For production or long-running background tasks, you can install the proxy as a Windows Service.
Note: This requires an Administrator PowerShell terminal.
# Install the service
cloudsqlctl service install --instance "project:region:instance"
# Configure startup type (Automatic, Manual, Disabled, Delayed)
cloudsqlctl service startup Automatic
# Start the service
cloudsqlctl service start
# Check status
cloudsqlctl service status
# Remove the service
cloudsqlctl service remove