之路 on it Road.com

解决方案

使用expect脚本。
例如:

#!/usr/bin/env expect
spawn mysql_config_editor set --skip-warn --login-path=client --user=root --password
expect "Enter password: "
send "$env(my_password)\r"
expect eof

密码可以存储在脚本可访问的操作足够安全的任何位置。

问题:

如何向 mysql_config_editor 提供密码,但不在命令行中输入密码?

在脚本中使用 expect 为 mysql_config_editor 提供密码
日期:2020-09-17 00:11:49 来源:oir作者:oir