What's the point of all this complexity? Since the system already has and uses SSH, why not do it in one line?<p><pre><code> # ssh hostname "echo 'use db; show tables' | mysql -p(password)"
</code></pre>
Or, for a remote, interactive MySQL session that prompts for a password:<p><pre><code> # ssh -t hostname mysql -p
</code></pre>
The linked content is overkill.