title: Making an alias for SSH MySQL login using ENDSSH heredoc
body: <p>I want to make an alias that is kept in my bashrc file to log into a remote MySQL db via SSH. 
  Assume that I can't add/alter any files on the remote machine that I'm SSHing into. Here's the relevant code.</p>
  
  <pre><code>function ssh_mysql {
    echo "SSHing to $server"
    ssh -t -t $suser@$server &lt;&lt;ENDSSH
      eval "mysql -h "$host" -u $user -p $pass $db"
  ENDSSH
  }
  alias wt_mysql=ssh_mysql
  </code></pre>
  
  <p>The Problem: Entering 'wt_mysql' into the terminal as an alias SSHs and logs into MySQL fine.. but when trying to enter any command/query/etc at the MySQL prompt, none of what I've submitted is executed/run. Including the 'exit' command. I have to ctrl C to get back to my local terminal. although its a bit out of my understanding I <em>believe</em> the problem is related to this topic,  <a href="https://stackoverflow.com/questions/7085429/terminating-ssh-session-executed-by-bash-script">Terminating SSH session executed by bash script</a>
  <br>
  How can I make sure that mysql and any subsequent commands are executed remotely?
  <br>
  Thanks!</p>