database

A 1-post collection

MySQL Database Replication over an SSH Tunnel

SSH Tunnel Setup Create an SSH key (Version 2) to allow passwordless replication: $ ssh-keygen -t rsa Copy the SSH key to the Master (assumes same user account on Master and Slave): $ ssh-copy-id master.machine.dom Setup the SSH Tunnel from the Slave to the Master on Slave Port 3305: $ ssh -f master.machine.dom -L 3305:127.0.0.1:3306 -N Now local port 3305 is actually port 3306 on the Master. Test that you can access the Master Database from the Slave: $ mysql -h 127.0.0.1 -P 3305 -uUSER -p You must use 127.0.0.1, not localhost, because MySQL treats “localhost” differently. If you are able to get a MySQL connection and verify access...