Tuesday, April 11, 2017

[google-cloud-sql-discuss] Compute Engine Instance and SQL instance (2nd gen) in same project won't connect

Unfortunately I cannot seam to find an answer that fits my situation!

I have followed the following guides when trying to connect a compute instance running CentOS 7 and docker to my Cloud SQL instance using the docker-proxy and can never connect on completion!

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

when I run gcloud compute instances describe [instance-name] i can verify the scope for https://www.googleapis.com/auth/cloud-platform is enabled

I run: sudo yum install mysql
- no errors
I then run: sudo usermod -aG docker $USER
-no errors

I then run: docker pull gcr.io/cloudsql-docker/gce-proxy:1.09
- no errors

I then configure using TCP sockets as follows:

sudo docker run -d -v /cloudsql:/cloudsql \
-p 127.0.0.1:3306:3306 \
gcr.io/cloudsql-docker/gce-proxy:1.09 /cloud_sql_proxy \
-instances=mycloud-sql-connection-name:us-central1:mysql-cloud-db-name=tcp_0.0.0.0:3306

after I hit enter a logn string is passed back
6aa53XXXXXXd58b4622337XXXXXXXXc92dec645dXXXXXXXXXa7eXXXX
-no errors produced

NOTE: configuring the TCP socket (the directions say to exclude the -v [PATH_TO_KEY_FILE]:/config and -credential_file=/config when you are on a Compute Engine instance (which I am)

I then run: mysql -u username -p --host 127.0.0.1

and get this error:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

If anyone can point in the right direction to resolving this I would greatly appreciate it!

Again both these instances are under the same project on GCP and have credentials set to allow all access from apps and instances within the project!

I've been at this for hours with no luck...

~sidgrafix

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/04698d7e-3b52-4345-8abf-c0c775ea4000%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment