How to automatically log-in to remote MySQL instance via ssh behind another host?

1

I have an alias set up to ssh to a remote machine through a proxy ...

alias sshcmd='ssh -t davea@proxy ssh destmachine'

but I want to set up an alias where I ssh into the remote machine and then automatically log in to MySql. However, this command doesn't work ...

alias mysqlremotecmd="ssh -t davea@proxy 'ssh destmachine mysql -uusername -ppassword -hmysqldomain.com db_sid'"

But this command just hangs. What is the proper way to build the alias to automatically log me in to the remote MySQL instance?

Dave

Posted 2015-03-08T18:21:38.757

Reputation: 25

What happens when you leave out the inner set of quotes? – Scott – 2015-03-08T18:44:50.157

Same thing -- the command just hangs – Dave – 2015-03-08T19:18:09.083

1try giving the 2nd ssh command a -t as well – glenn jackman – 2015-03-08T20:13:39.027

Yup, adding -t caused everything to work. – Dave – 2015-03-09T14:06:43.303

No answers