I am having a strange issue with my GCE Proxy. I used to have a docker image with an application that would use the GCE proxy to connect to the mysql database(second generation). Everything worked fine, but I had to stop the services for like a month.
Now I need them back up and for some reason I am not able to connect to the dabase(configuration did not basically chang, and I am using the same docker image with the code)
On closer inspection I see in logs:
Caused by: java.sql.SQLException: Access denied for user 'my-usr'@'cloudsqlproxy~SOME_IP' (using password: YES)
The problem is, that the "SOME_IP" is not actually the sql instance IP and I have no idea from where that IP is coming from.
Does anyone have an idea on how to fix this issue?
I did try to:
-recreate the database user
-recreate the service account
Any advice is welcomed
You can use Cloud SQL proxy to connect your mysql instance, see the step by step below:
Download the proxy:
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
Make the proxy executable:
chmod +x cloud_sql_proxy
Using the proxy to connect to multiple instances
./cloud_sql_proxy -instances=yourProject:us-central1:myInstance=tcp:3306,yourProject:us-central1:myInstance2=tcp:3307 & mysql -u myUser --host 127.0.0.1 --port 3307
Try to connect your database
mysql -h127.0.0.1 -u$YOUR_CLOUD_SQL_USER -p$YOUR_CLOUD_SQL_PASSWORD
Hoping it helps you!