How to connect to database using ssh tunnel

If your database server has remote access blocked to avoid external attacks, like mine, you can access the database using desktop clients. You need to use phpMyAdmin on the server to manage it.

But there’s a workaround to connect to a remote database: using ssh tunnel!

Steps to connect to the database using ssh:

1 – Create a ssh access to server

Make sure you have access to the server where is the database:

IP: 123.456.789.123

user: myusername

password: mypassword

2 – Connect to database using ssh

host: localhost

port: 3306

user: database_username

password: database_password