B. Patali
B. Patali

Reputation: 31

How do I resolve this error when trying to connect to an SQL server hosted on a Google Compute Engine Ubuntu VM

For a database course that I'm in, the professor has tasked us with setting up several VM MySQL servers and remote connections. I've found proper documentation to solve most of my problems, but I've pored over docs trying to find a solution to my latest issue.

I've set up an Ubuntu VM on the Google Cloud Compute Engine. I installed a MySQL server to this VM instance, and I need to log in remotely from my laptop. I've followed this documentation https://cloud.google.com/solutions/mysql-remote-access and this youtube video https://www.youtube.com/watch?v=f5qQDm3ciDg.

However, I still get an Unable to Connect to Server message when I test my connection. What could I be overlooking that will help me connect?

Thanks!

Upvotes: 1

Views: 96

Answers (1)

B. Patali
B. Patali

Reputation: 31

So, I slammed my head against a wall for long enough to realize that ssh will be an easier solution than a direct connection.

So, at least for my Windows machine, these are the steps I followed to make the connection:

  1. Download the sql server (You don't need to add a user unless necessary, and you don't change the bind-address in the config file).

  2. Use PuTTYgen to create a private public key pair. Export the private key as an openssh format (in the export options)

  3. Click the edit button on your VM instance then scroll down to the SSH key section.

  4. Paste the public key into the text box (be sure to change the last comment portion to a username on the Linus VM)

  5. Use the SSH connection on MySQL Workbench. Use the external IP of your VM as the first (ssh) host name and localhost as the second (SQL) host name. Input all other info as it is asked for.

Upvotes: 2

Related Questions