2023年12月

MySQL-避免密码明文写入shell脚本

日常编写mysql脚本时常用命令:mysql -h${mysql_host} -P${mysql_port} -u${mysql_user} -p${mysql_password} ${mysql_dbname} -e "source ./sql/sql1.sql"
命令行将提示:Warning: Using a password on the command line interface can be insecure.

解决方法:

  1. 使用 defaults-extra-file 选项

    defaults-extra-file 是 mysql 命令的一个选项,它允许你指定一个包含额外配置信息的配置文件,对于在执行mysql命令时提供一些额外的配置非常有用。

- 阅读剩余部分 -