scho
scho

Reputation: 3585

How to connect to Google Cloud SQL by SSL?

I have created a ssl follow:

https://cloud.google.com/sql/docs/configure-ssl-instance

And read this document:

https://cloud.google.com/sql/docs/mysql-client#connect

After I created a new mysql instance and download the three pem files to local. I want to connect to that server:

mysql -u<USERNAME> -p -h <IP_ADDRESS> --ssl-ca=/local/path/to/server-ca.pem --ssl-cert=/local/path/to/client-cert.pem --ssl-key=/local/path/to/client-key.pem

And type the password, again it said:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Why?

Upvotes: 2

Views: 7970

Answers (1)

Kevin Malachowski
Kevin Malachowski

Reputation: 173

Did you follow the instructions under the heading "Grant access to your instance? It links to another document that explains how to add IP addresses to Authorized Network list of your Cloud SQL instance. Even when using SSL certificates you must add the IP address as an Authorized Network.

Upvotes: 4

Related Questions