google-cloud-platformgoogle-cloud-sqlgoogle-cloud-shell

Connecting to an SSL-Only Cloud SQL database through Cloud Shell


So obviously I have my certificates for connecting to the database externally, but how do I connect to an SSL-only database using Cloud Shell?

If I tap "Connect using Cloud Shell" on the Cloud SQL page and use their pre-filled Shell command:

gcloud sql connect INSTANCENAME --user=root --quiet

It won't let me log in using my root password, and as far as I can see there are no options to supply certificates like there is when just using a cli mysql client. If I turn forced SSL off, I can connect correctly. Am I missing something obvious?


Solution

  • As stated on the official documentation for CloudSQL

    gcloud command group doesn't support SSL connections to your CloudSQL instance.

    So, it's an expected behaviour that doesn't allow you to log in.

    You can try instead something like this instead.