运行 AutoMysqlBackup 时的警告

use*_*769 5 mysql ubuntu

我正在使用 Automysqlbackup.sh 文件在 Ubuntu 上进行 MySql 备份。我只有 1 个数据库。但是当我运行这个脚本时,它会生成几个警告(加上一个错误邮件),如下所示

Errors reported during AutoMySQLBackup execution.. Backup failed
Error log below..
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Run Code Online (Sandbox Code Playgroud)

我正在使用来自以下链接的最新版本的 AutoMysqlBackup 文件 http://sourceforge.net/projects/automysqlbackup/

我还尝试通过创建一个用于写入密码并在 automysqlbackup 脚本中读取它的 .properties 文件来解决该错误。但没有帮助!

谁能帮我?

小智 5

您的问题的解决方案如下:-

在第 115 行,有一行说

removeIO
Run Code Online (Sandbox Code Playgroud)

在 removeIO 之后添加:

# Remove annoying warning message since MySQL 5.6
if [[ -s "$log_errfile" ]]; then
sedtmpfile="/tmp/$(basename $0).$$.tmp"
grep -v "Warning: Using a password on the command line interface can be insecure." "$log_errfile" > $sedtmpfile
mv $sedtmpfile $log_errfile
fi
Run Code Online (Sandbox Code Playgroud)

并且您将不会收到更多关于在命令行上使用密码不安全的每日电子邮件。

参考链接:

http://www.redeo.nl/2013/11/automysqlbackup-warning-using-password-command-line-interface-can-insecure/

但我不知道这是否是最干净的解决方案。


要使此解决方案适用于 MySQL 5.7+,需要修改 grep 语句以考虑更改的警告消息:

grep -v ".*: \[Warning\] Using a password on the command line interface can be insecure\." "$log_errfile" > $sedtmpfile
Run Code Online (Sandbox Code Playgroud)