Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

EXTERNAL_QUERY

As ICapture.PNG followed all the steps you have said but I am still getting this error.

i am using Public IP, i have given access to in IAM also.

Invalid table-valued function EXTERNAL_QUERY Failed to connect to MySQL database. Error: MysqlErrorCode(2013): Lost connection to MySQL server during query at [1:15]

 

Thanks

0 1 323
1 REPLY 1

 

This error message usually indicates that BigQuery is unable to maintain a connection to your Cloud SQL MySQL instance.

Things to check:

  • Cloud SQL MySQL instance status: Make sure that the instance is running and healthy.
  • BigQuery connection status:Make sure that the BigQuery connection to your Cloud SQL MySQL instance is enabled and configured correctly.
  • BigQuery IAM permissions: Make sure that the user or service account that is running your BigQuery query has the necessary IAM permissions to access your Cloud SQL MySQL instance.
  • Connection configuration: Make sure that the BigQuery EXTERNAL_QUERY function is using the correct connection settings, including the public IP address, port number, and database name of your Cloud SQL MySQL instance.
  • Authentication method: Make sure that the BigQuery EXTERNAL_QUERY function is using the correct authentication method, either SQL client certificate or MySQL password authentication.

Additional troubleshooting steps:

  • Try connecting to your Cloud SQL MySQL instance from a different client. This will help you to determine if the issue is with BigQuery or with your Cloud SQL MySQL instance.
  • Try running the BigQuery query again. Sometimes, the issue can be resolved by simply retrying the query.

If you have tried all of the above and you are still getting the error, you can contact Google Cloud support for assistance.

Notes:

  • If you are using SSL/TLS to connect to Cloud SQL, make sure that all three components (client certificate, client key, and server CA certificate) are correctly configured.
  • The EXTERNAL_QUERY function does not use a connection string to connect to Cloud SQL.