user1978019
user1978019

Reputation: 3346

Is it possible to see connection attempts to a Google Cloud SQL instance?

We are currently encountering the following error when trying to connect to a Cloud SQL instance: Lost connection to MySQL server at 'reading initial communication packet', system error: 0.

This is a familiar error, and as detailed here usually means the IP address needs to be whitelisted. However, we believe we have done so.

Is there a way to see connection attempts and their IP addresses that have been made (and refused) to the Cloud SQL instance?

Upvotes: 4

Views: 1287

Answers (3)

David Traves
David Traves

Reputation: 1

Figured I might help someone who stumbles here.

Had exactly the same issue essentially trying to connect to a GCP SQL instance from a hosting provider.

Whitelist the IP address that is shown in my cpanel and it will not connect. (It used to, but the provider made some changes with their infrastructure lately and it stopped working)

put 0.0.0.0/0 in my Cloud Platform whitelist and it connects no problem.

So now I know that my cpanel IP is not the IP trying to connect to GCP.

After some hair pulling (figured that the bare metal server had a different IP than my cpanel IP, it did, but this also didn't work.)

finally tried the IP address for the name servers that point to my domain and bam. All is good.

If you are facing this issue, try your name server (usually something like NS1.hostingprovider.com etc..). I put both the NS1 and NS2 ip's in the whitelist and we are working fine.

Upvotes: 0

user1978019
user1978019

Reputation: 3346

According to @Razvan, as of September 2014, this information isn't exposed.

We ended up using CIDR blocks to search the space and find the actual IP address. This is unsatisfying, obviously, but it's a way to pin down the problem.

If other people want to sanity check that the problem is their IP is being refused, you can add 0.0.0.0/0 in order to accept all ranges and try to connect. If it works, you know what is the problem.

Be absolutely sure to remove this as an accepted range, after you are done, however!

Upvotes: 0

Razvan Musaloiu-E.
Razvan Musaloiu-E.

Reputation: 1320

Currently we don't expose that information but it is something we would like fix. :-)

Upvotes: 2

Related Questions