App overview screenshotSQL and Database Guides
Try our free SQL Client
Connecting to MySQL
Connecting to Drivers
Installing MySQL
Setting up MySQL
MySQL   >   
Connecting to MySQL   >   
MySQL Bastion on Google Cloud

Connect to MySQL on Google Cloud with SSH

Access The gcloud Command Line Tool

Make sure you have installed gcloud which you will need for setting up and connecting to your SSH tunneled MySQL database. Installation instructions for Google Cloud SDK command line tools are here. You will typically need to close your terminal and restart it to make sure all the environmental variables are set.

Ensure Google Cloud Compute Access

Check the networking of your Cloud SQL instance so that it matches the Compute Engine network.

Check the networking of your Cloud SQL instance so that it matches the Compute Engine network.

Navigate to your list of instances then Click on the Name (ssh-bastion in this case) > Click Edit at the top > Scroll to SSH Keys > Click Show SSH Keys to copy in the public key.

The public key is the result of running a command like cat ~/.ssh/ and comes from a key that you must create yourself on your machine.

IMPORTANT: The comment on the key must match the username of your google cloud account. So if your Gsuite or Gmail email is you must generate the key with ssh-keygen -C "arctype". If you do not do this and still upload the key, you will get permission denied.

Add a SSH key to Google Cloud.

Get the Database Credentials

We show how to find your Google Cloud SQL credentials in another article, but for this setup you need the Private IP Address.

Connect over SSH to Your Google Cloud Instance

In a SQL client like Arctype, you must enter several pieces of information, the Database Host, Database User, Database Password, Database Name, SSH Host, SSH User, and SSH Key File. These can all be found from the steps above.

Click Test Connection to ensure everything is working and then Save to start editing your database!

Get help on databases and SQL. Join our Discord community.