Home / Blog / Post
Ssh Tunnel To Database
Added on 04th January 2018 in Tutorial

When developing or debugging code, its best practice to do everything locally, including using a local database installation. But sometimes you need access to libe data, in such cases as;

  • Developing requiring live data
  • Debugging an issue

The simplest way do achieve this is using an SSH Tunnel, but when you do so be aware that you can affect live data. So only use not descructive queries, such as SELECTS.

  1. Disable Local Database sudo service mysql stop
  2. Create Tunnel ssh [email protected] -L3306:localhost:3306

Now interacting with the local version of your database will actually be interacting with the live database.

Hi there, I am christopher shaw, a software developer form South Yorkshire, England.

I love tinkering with all things tech, and opened this website as a web presence for myself and a place to keep my notes and snippets. Hopefully you will find something here to help

Christopher Shaw