title: MySQL Database Connection via SSH Tunnel
body: <p>i have a problem with our new database. The only way to access the database is throw a SSH tunnel. But it doesn't work...</p>
  
  <p>I use following commands:</p>
  
  <pre><code>sshpass -p &lt;PASSWORD&gt; ssh &lt;USER&gt;@&lt;DOMAIN&gt; -p &lt;PORT&gt; -L 3306:localhost:3306 -f -N
  </code></pre>
  
  <p>I think the ssh tunnel works and is established.</p>
  
  <p>Now I want to connect via Shell-File the database.</p>
  
  <pre><code>deposit=`mysql -h localhost --port=3306 -u &lt;DATABASEUSER&gt; --password=&lt;DATABASEPASSWORD&gt; --skip-column-names -e "&lt;MYSQLSYNTAX&gt;"`
  </code></pre>
  
  <p>But there is always folowing error:</p>
  
  <pre><code>ERROR 1045 (28000): Access denied for user '&lt;DATABASEUSER&gt;'@'localhost' (using password: YES)
  </code></pre>
  
  <p>Do you have any ideas or am I doing something wrong?</p>
  
  <p>Thank you very much!</p>