【发布时间】:2020-10-15 23:30:54
【问题描述】:
我在 linux 中有一个脚本。 while 循环中的读取语句不起作用。我做了很多尝试,但无济于事。这是我的代码:
while read instanceInFile
do
echo -e "$instanceInFile"
read -sp "Enter Password for the instance: " paswrd
mysql -uauser -p$paswrd -e "create user '$user'@'$ip' identified by '$user';"
done<"allInstances.out"
allInstances.out
是一个包含要运行的环境脚本列表的文件。当我运行脚本时,它显示以下错误
ERROR 1045 (28000): Access denied for user 'power-user'@'some-ip' (using password: YES)
虽然它不从用户那里读取。
【问题讨论】:
-
这可能会有所帮助:stackoverflow.com/a/46021410/3776858