0

I have a Google Cloud SQL (MySQL) instance which I can connect from my Local development VM using mysql client.

However, when I try to connect using the cloud_sql_proxy (needed for the python project setup), I get the error x509:certificate has expired or is not yet valid.

2018/03/10 07:05:37 couldn't connect to "q:a:q4": x509: certificate has expired or is not yet valid

Mirror Mirage
  • 1,287
  • 1
  • 8
  • 7
  • As per our discussion at [issue tracker](https://issuetracker.google.com/issues/74495856), and after following this [guide](https://cloud.google.com/sql/docs/mysql/connect-admin-proxy), please update the question with more details for further assistance. Thank you. – Fady Mar 12 '18 at 18:30
  • 1
    I followed your instructions and created a service account, downloaded the json file locally, and my god!!!! it connected using cloud_sql_proxy. phew! I will proceed with my learning example https://cloud.google.com/python/getting-started/using-cloud-sql. Thank you so much Fadi – Mirror Mirage Mar 14 '18 at 11:18

1 Answers1

1

Here are the steps I followed to get over this.

My requirement was to run the bookshelf python tutorial application as detailed in https://cloud.google.com/python/getting-started/tutorial-app

and I was getting stuck at the cloud_sql_proxy error. https://cloud.google.com/python/getting-started/using-cloud-sql

Following are the steps I did 1) I created a service account with Cloud SQL Client role as detailed in https://cloud.google.com/sql/docs/mysql/sql-proxy#create-service-account

2) I downloaded the json credential file

3) Used the command ./cloud_sql_proxy -instances=[CONNECTIONINSTANCE]=tcp:3306 -credential_file=./mycredentials.json

4) Then opened up a mysql -u root -p --host 127.0.0.1

Oh btw, I also had a problem with my date time on my virtualbox. issue the command timedatectl to see if your local time on the virtualbox (ubuntu) is proper. If you have the habit of using hibernating the VM using "save" option instead of a shutdown, most probably the time is out of sync. you better do a restart of the VM and this problem will go away

All the best with your Google Cloud App development!

Thanks to @Fady who helped me out with this issue

Mirror Mirage
  • 1,287
  • 1
  • 8
  • 7