If you encounter issues with cloudsqlctl, follow these steps to diagnose and resolve them.
The first step in troubleshooting is to run the built-in diagnostics tool:
cloudsqlctl doctorThis command checks:
- Network Connectivity: Can you reach Google Cloud APIs?
- Gcloud CLI: Is it installed and authenticated?
- Credentials: Are Application Default Credentials (ADC) set up correctly?
- Proxy Binary: Is the Cloud SQL Proxy binary present and executable?
- Service Status: Is the Windows Service healthy (if installed)?
Cause: The Cloud SQL Proxy requires Application Default Credentials (ADC) to authenticate with the Google Cloud API.
Solution: Run the following command to generate the ADC file:
cloudsqlctl auth adcOr manually: gcloud auth application-default login
Cause: The active project selected in gcloud might be incorrect, or your account doesn't have permissions for the instance.
Solution:
-
Check your active project:
gcloud config get-value project -
Switch projects if necessary:
cloudsqlctl setup # OR gcloud config set project <PROJECT_ID>
-
Ensure your user has the
Cloud SQL Clientrole.
Cause: Port conflicts (default 5432 for Postgres, 3306 for MySQL) or invalid configuration.
Solution:
-
Check the logs for detailed error messages:
cloudsqlctl logs
-
Try running the proxy in the foreground to see immediate output:
cloudsqlctl start --foreground
Cause: Usually due to missing credentials or incorrect binary path.
Solution:
- Ensure you have set a Service Account key with
--scope Machine:cloudsqlctl auth set-service-account --file <path> --scope Machine
- Check the Windows Event Viewer (System logs) for specific service errors.
- Verify the service configuration:
cloudsqlctl service status
If your configuration is corrupted, you can reset the tool to its default state:
cloudsqlctl resetWarning: This will remove your local configuration files and the downloaded proxy binary. You will need to run cloudsqlctl setup again.
If you still have issues, please open an issue on our GitHub Repository with the output of cloudsqlctl doctor and cloudsqlctl logs.