Reputation: 662
As shown in the title, I want to open mysql at my local terminal. I wrote 2 lines:
ssh -i pem user@1.1.1.1 #Log in to server with password
mysql -h xxx -u user -p #connect to MySQL with password
Is it possible to make it in one line? Or Can I write it in a script? Really fresh on Bash:)
Upvotes: 0
Views: 128
Reputation: 3860
Last part of ssh's synopsis in the man page is [command].
Since mysql is a screen based program you need to run ssh with -t
This should work:
ssh -t -i pem user@1.1.1.1 "mysql -h xxx -u user -p"
Upvotes: 1