MySQL replication throught SSH tunnel
<p>I am having trouble setting up the replication via <code>SSH</code> tunnel despite many hours spent throught the official docs, articles and SO questions.</p>

<p>My master is <code>192.168.0.105</code> and the Slave is <code>192.168.0.104</code>. I have already set up the SSH tunnel via:</p>

<pre><code>ssh -L 3305:127.0.0.1:3306 tunneluser@192.168.0.105 -f -N
</code></pre>

<p>where <code>tunneluser</code> is a local user on my <strong>master</strong>.</p>

<p>I get the following output on a slave (omitted the irrelevant lines):</p>

<pre><code>mysql&gt; SHOW SLAVE STATUS \G
*************************** 1. row ***************************
               Slave_IO_State: Connecting to master
                  Master_Host: 127.0.0.1
                  Master_User: slave_user
                  Master_Port: 3305
                  ...
             Slave_IO_Running: Connecting
            Slave_SQL_Running: Yes
                  ...
                Last_IO_Errno: 2003
                Last_IO_Error: error connecting to master 'slave_user@127.0.0.1:3305' - retry-time: 10  retries: 1
                  ...
1 row in set (0.00 sec)
</code></pre>

<p>The part that puzzles me is that if I try:</p>

<pre><code>mysql -h 127.0.0.1 -P 3305 -u slave_user -p
</code></pre>

<p>It logs-in without any issues. I am beginning to think this has something to do with permissions, but I cannot find any hint to confirm my theory.</p>

<p>I tried to setup the tunnel as <code>mysql</code> user, however, that did not work as well. Didn't really expect but I had to give it a shot.</p>

<p><strong>Does anyone have any suggestion on how to debug this?</strong></p>

<p>If I go directly through port <code>3306</code>, it works without any issue.</p>