[英]Why does mysql command over ssh does not prompt for password?
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?
我是否缺少ssh参数?
Another thing to note is that if you remove the < ~/data.sql
, the prompt does appear as expected. 还要注意的另一件事是,如果删除
< ~/data.sql
,则提示确实会出现。
您需要创建一个伪终端,以便mysql
可以从/dev/tty
而不是标准输入中读取:
ssh -t user@host 'mysql -u dbuser -p database < ~/data.sql'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.