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

Big Query can't connect to Cloud SQL

Please help

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]

Region: Instance and Connection = asia-southeast1

Already set instance to Public IP

Already set BQ admin, Connection Admin

Already enabled API

Solved Solved
0 15 8,483
2 ACCEPTED SOLUTIONS

To resolve this issue, you can follow these steps:

  1. Ensure that you have used valid credentials when creating the connection for Cloud SQL.
  2. Check if the service account associated with the Cloud SQL connection has the Cloud SQL Client (roles/cloudsql.client) role. The service account follows the format service-PROJECT_NUMBER@gcp-sa-bigqueryconnection.iam.gserviceaccount.com.
  3. Verify that the connection details for the Cloud SQL instance are correctly specified in the EXTERNAL_QUERY function.

View solution in original post

You will need to set the  default_authentication_plugin database flag on your CloudSQL to  caching_sha2_password

Please refer to https://cloud.google.com/sql/docs/mysql/flags#list-flags-mysql 

 

 

 

View solution in original post

15 REPLIES 15