Hello @pol_rouxel ,
Welcome to the Google Cloud Community!
Your error message suggests that the user ‘serviceaccountusername’ is unable to connect from the ‘cloudsqlproxy~localIP’. To resolve this, try the following steps:
- Ensure the service account is assigned the “cloudsql.client” role, which is necessary for connecting to Cloud SQL instances. You can find more information here: cloudsql.client role. This role allows the service account to connect to Cloud SQL instances.
- Verify that the ‘db_user’ variable in your script uses the Cloud SQL username, not the service account email.
- Check that the host in your connection settings is correct. The error message mentions `“cloudsqlproxy~‘localIP’” as the host. It should be the public IP address of your Cloud SQL instance for a public connection, or the private IP address if using a private network.
If you’re still encountering issues after these steps, its best to consider reaching out to our Google Cloud Support.