How to connect to MySQL Server using SSH key pairs

In order to backup MySQL Server via SqlBak you have to set a connection via TCP/IP. In other words, SqlBak communicates with a database through port 3306.

However, it may not be possible to connect to a database port directly for security reasons. Sharing a database port for external connections is a bad practice, and by default, MySQL Server disallows such connections.

If the server on which your database is located supports SSH connections, then you can configure port forwarding of the MySQL Server to your local port via SSH. SqlBak will communicate with its local port 3306, and the SSH tunnel will forward this data to port 3306 on which the MySQL Server is located.

To set an SSH connection, you will need to know the following information:
  • UserName and Password you use to connect to your databases
  • Information for SSH connection
To configure an SSH connection, please specify “localhost” in the Server Name box, and also please fill in the “port” box if it differs from the default value.
Then go to the “Advanced settings” and check off the “Connect using SSH tunnel” option.
In the “Hostname” box, please specify the network address of the server where your database is located, for example, myserver.com.
In the “SSH port” box, leave the value 22, and in the “Local mapped port” box, specify the value of the database port (3306).
Now, please specify the data for the connection and set your backup job.

Leave a Comment