Reputation: 6206
I'm attempting to run a command like the following:
ssh user@host 'mysql -u dbuser -p database < ~/data.sql'
I'm expecting it to prompt me a password like it normally would if you're on that host.
However, it does not do that. Is there an ssh argument I'm missing or something?
Another thing to note is that if you remove the < ~/data.sql
, the prompt does appear as expected.
Upvotes: 1
Views: 407
Reputation: 781716
You need to create a pseudo-terminal so that mysql
can read from /dev/tty
instead of standard input:
ssh -t user@host 'mysql -u dbuser -p database < ~/data.sql'
Upvotes: 3