title: Can't connect to local MySQL server through socket error when using SSH tunel
body: <p>I am trying to use dplyr to connect to a remote database, that I usually query through a ssh tunnel.</p>
  
  <p>I first set up a ssh tunnel like the following:</p>
  
  <pre><code>alias tunnel_ncg='ssh -fNg -L 3307:127.0.0.1:3306 mysqluser@myhost mysql5 -h 127.0.0.1:3306 -P 3307 -u mysqluser -p mypassword'
  </code></pre>
  
  <p>At this point I can access the database by connecting to localhost:3307. For example:</p>
  
  <pre><code>mysql -h '127.0.0.1' -P 3307 -u mysqluser
  </code></pre>
  
  <p>If I try to access the same database through dplyr, I get an error complaining that it can't connect to the local MySQL socket:</p>
  
  <pre><code>&gt; conDplyr = src_mysql(dbname = "mydb", user = "mysqluser", password = "mypassword", host = "localhost", port=3307)
  Error in .local(drv, ...) : 
    Failed to connect to database: Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  </code></pre>
  
  <p>My understanding is that RMySQL/dplyr are trying to looking for a socket file in the local computer, however they should really be looking for it in the remote server. Is there a way to fix this, or a work-around?</p>
  
  <p>UPDATE:</p>
  
  <p>If I try to connect through dbConnect/RMySQL, the connection works fine:</p>
  
  <pre><code>&gt; dbConnect(dbDriver("MySQL"), user="mysqluser", password="mypassword", dbname="mydb", host="127.0.0.1", port=3307)
  &lt;MySQLConnection:0,1&gt;
  </code></pre>