Sunday 26 September 2021

Securely connect to Google CloudSQL MySQL instance from DBeaver

Setup a driver using Googles Socket Factory

Driver Manager → New

Name: Google Cloud SQL – MySQL
Type: MySQL
Class Name: com.mysql.cj.jdbc.Driver
URL Template: jdbc:mysql:///[{database}]?cloudSqlInstance={host}
Default Port: 0



Libraries → Add Artifact
GroupId: mysql
ArtifactId: mysql-connector-java
Version: RELEASE

→ Add Artifact
Group Id: com.google.cloud.sql
Artifact Id: mysql-socket-factory-connector-j-8
Version:RELEASE


Driver Properties → right click → add new
socketFactory: com.google.cloud.sql.mysql.SocketFactory
cloudSqlInstance: {host}

Create a connection

set the username and password as usual

Edit the cloudSqlInstance property



Done!