google-cloud-platformgoogle-cloud-runmysql-connectorgoogle-vpc

MySqlConnector.MySqlException: (0x80004005): Cannot find Unix Socket at


I have a GCP MySQL database and a Cloud Run .net webAPI web service. They communicate via a VPC on GCP. This all worked fine. I cloned the database and updated my code in the web service to use the new connection name (exactly the same as the old one, just with "-benchmark" at the end. I have a connection test setup in GCP which runs successfully.

I have double checked and all permissions and settings on the SQL instance are the same.

Does anyone know what might have gone wrong with the cloning of the database?

To clarify, using the original database works fine, all I did was clone the DB and change the Server in the MySqlConnectionStringBuilder.Server to be the new DB instance connection name and I get the error MySqlConnector.MySqlException: (0x80004005): Cannot find Unix Socket at


Solution

  • Since new SQL instance will be used. Aside from updating the code to use the new connection, you should also explicitly update the cloud SQL connections of your cloud run.

    Like any configuration change, setting a new configuration for the Cloud SQL connection leads to the creation of a new Cloud Run revision. Subsequent revisions will also automatically get this Cloud SQL connection unless you make explicit updates to change it

    The only exception here is when you used Java to write you application, since you do this in the Java Cloud SQL Connector.