7
votes

I'm attempting to connect to a Google Cloud SQL instance via a MySQL client which requires me to connect via the Google Cloud proxy. I have followed all instructions on the Google Cloud Docs, yet after running the command to start the proxy (using correct INSTANCE_CONNECTION_NAME and PATH_TO_KEY_FILE), I receive the following error.

Command :

./cloud_sql_proxy -dir=/cloudsql -instances=INSTANCE_CONNECTION_NAME \ -         credential_file=PATH_TO_KEY_FILE &

Error :

couldn't connect to "INSTANCE_CONNECTION_NAME": ensure that the account has access to "INSTANCE_CONNECTION_NAME" (and make sure there's no typo in that name). Error during createEphemeral for INSTANCE_CONNECTION_NAME: googleapi: Error 403: Access Not Configured. Cloud SQL Administration API has not been used in project 563584335869 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=563584335869 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured

I have confirmed that the Google Cloud SQL API is enabled on the console for the project, but the weird thing is my project name is not 563584335869, and I have already set the correct project name via the GC CLI to no avail. So when visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=563584335869, I see:

The API "sqladmin.googleapis.com" doesn't exist or you don't have permission to access it

I also created a service account under the role Cloud SQL Client, and downloaded the private key which PATH_TO_KEY_FILE points to.

1
Your INSTANCE_CONNECTION_NAME should follow this pattern: project_id:region:instance_id (you can copy it from Cloud SQL section of the Cloud Console). Check that if 563584335869 is not your project_idJ.L Valtueña
I'm getting this same weird error. Have you managed to find a solution?Satjapong Meeklai

1 Answers

0
votes

Can you confirm that you have enabled the "Cloud SQL API" (sqladmin.googleapis.com) and not "Cloud SQL" API? (sql-component.googleapis.com)?

Can you also give some more information as to your environment? Are you running this from your local machine or are you working in Cloud Shell?