As @siamsot mentioned, there is an article in the official GCP documentation on how to connect to a Cloud SQL instance.
Basically, you have the following options to connect to a Cloud SQL instance:
- By using the proxy (Second Generation instances only)
- By configuring access for one or more public IP addresses
- By using the JDBC Socket Factory (for the Java programming language,
Second Generation instances only) - By using the Cloud SQL Proxy library (for the Go programming language, Second Generation instances only)
solved I need to connect to Google cloud mysql using java but without using spring boot?