title: how to mysqldump remote db from local machine
body: <p>I need to do a mysqldump of a database on a remote server, but the server does not have mysqldump installed. I would like to use the mysqldump on my machine to connect to the remote database and do the dump on my machine.</p>
  
  <p>I have tried to create an ssh tunnel and then do the dump, but this does not seem to work. I tried:</p>
  
  <pre><code>ssh -f -L3310:remote.server:3306 user@remote.server -N
  </code></pre>
  
  <p>The tunnel is created with success. If I do </p>
  
  <pre><code>telnet localhost 3310
  </code></pre>
  
  <p>I get some blurb which shows the correct server mysql version. However, doing the following seems to try to connect locally</p>
  
  <pre><code>mysqldump -P 3310 -h localhost -u mysql_user -p database_name table_name
  </code></pre>