Hi guys,
I'm having a 403 issue when trying to use the proxy. I've found a lot of issues about this matter online, but I've tried everything I've found and nothing seemed to work.
My goal is to access the cloud sql instance through kubernetes (google container cloud). As I couldn't make it work, I retried to connect through a gce engine, then my local machine. I always end up with the same issue.
So I activated the API, created a service with cloud sql client and viewer rights (as I read viewer could be needed) and downloaded the file.
I created a user (replacing myinstance1 by my instance name): gcloud sql users create proxyuser cloudsqlproxy~% --instance=myinstance1
I actually also tried to connect as root, and with a much more permissive service account file, with no more luck.
The problem is always the same. On the proxy:
$./cloud_sql_proxy -instances=myproject:us-central1:myinstance1=tcp:3306 -credential_file=./myserviceaccount.json
2017/10/01 15:32:51 Listening on
127.0.0.1:3306 for myproject:us-central1:myinstance1
2017/10/01 15:32:51 Ready for new connections
2017/10/01 15:32:55 New connection for "myproject:us-central1:myinstance1"
2017/10/01 15:33:01 couldn't connect to "myproject:us-central1:myinstance1": ensure that the account has access to "myproject:us-central1:myinstance1" (and make sure there's no typo in that name). Error during createEphemeral for myproject:us-central1:myinstance1: googleapi: Error 403: The client is not authorized to make this request., notAuthorized
and on the client side:
$mysql -u root -p --protocol=TCP --host="127.0.0.1"
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
$mysql -u proxyuser -p --protocol=TCP --host="127.0.0.1"
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
$mysql -u root -p --host 127.0.0.1
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
... among others.
I forgot to precise that I tried to connect to the db using Cloud Shell (by clicking on the link), and it worked fine.
I'm stuck. I am not sure if either I missed something, or if I am hitting a bug.
Thanks a lot to anyone who's willing to help,
Thibault.