错误重现:

命令行或者shell脚本中执行以下命令,如果您当前服务器mysql版本是大于5.6的,则会出现警告:Warning: Using a password on the command line interface can be insecure. 这是mysql避免明文密码出现在脚本中做的安全提升

mysqldump -h$ -u$ -p$ -P3306 -B ${dbnames} --single-transaction --triggers --routines --events --master-data= -F | gzip > $data_dir/$1_`date +%Y%m%d`.sql.gz

警告信息看着不爽,特别是crontab定时执行shell时,邮件会收到“原本该忽视”的stderr标准错误。

解决方案:

这里只说一个,利用 mysql_config_editor 进行预先设置连接信息,具体做法如下:

1、设置登录信息

mysql_config_editor set --login-path=mall --host=mall.palcent.com --user=dumper -p

设置完毕,会在用户主目录%home%下生成一个.mylogin.cnf 文件,比如root用户,则生成 /root/.mylogin.cnf 。

2、查看当前主机上的加密文件

mysql_config_editor print --all

3、使用加密文件

登录Mysql

mysql --login-path=mall
# Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is

备份数据库

mysqldump --login-path=mall --databases ${dbnames} --single-transaction --triggers --routines --events --master-data= -F | gzip > $data_dir/$1_`date +%Y%m%d`.sql.gz

当然还有其他解决方案, 请自行参考以下参考链接!

参考链接:

https://www.cnblogs.com/rockbes/p/3972763.html (mysql_config_editor 用法)

https://blog.csdn.net/zxssoft/article/details/89667874

https://dev.mysql.com/doc/refman/8.0/en/password-security-user.html (官方解决方案)

mysql: "Warning: Using a password on the command line interface can be insecure." 解决方法的更多相关文章

  1. MySQL Warning: Using a password on the command line interface can be insecure.解决办法

    转自 http://www.cnblogs.com/sunss/p/6256706.html  被一个小朋友问到,直接公布答案: If your MySQL client/server version ...

  2. zabbix 3.4监控mysql,提示mysql: [Warning] Using a password on the command line interface can be insecure.

    mysql从5.6版本开始,如果是命令行直接出现了数据库连接密码就会有以下警告: mysql: [Warning] Using a password on the command line inter ...

  3. Mysql: [Warning] Using a password on the command line interface can be insecure

    mysql: [Warning] Using a password on the command line interface can be insecure MySQL 5.6 警告信息 comma ...

  4. mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    错误情况 解决办法: 首先查看mysql的命令 其次修改root用户的密码 set password for 'root'@'localhost' = password('123456'); 最后退出 ...

  5. Warning: Using a password on the command line interface can be insecure.解决办法

    被一个小朋友问到,直接公布答案: If your MySQL client/server version is a 5.6.x a way to avoid the WARNING message a ...

  6. MYSQL报警:Warning: Using a password on the command line interface can be insecure.

    问题描述:执行下面的语句,sql是执行成功了,但是出现了一个报警,报警看上去始终不舒服 mysql -hip -Pport -uuser -ppassword -e "use db;dele ...

  7. MYSQL5.7脚本运行时出现[Warning] Using a password on the command line interface can be insecure

    MYSQL版本:5.7 在写linux脚本执行MYSQL命令的时候,如果使用 MYSQL="mysql -hlocalhost -P3306 -uroot -p666666" 登陆 ...

  8. MySQL 5.6 Warning: Using a password on the command line interface can be insecure

    MySQL 5.6 在命令行输入密码,就会提示这些安全警告信息. Warning: Using a password on the command line interface can be inse ...

  9. mysql 备份报错mysqldump: [Warning] Using a password on the command line interface can be insecure.

    -------------------------------------------------------------------------------- mysql 备份报错mysqldump ...

随机推荐

  1. JavaEE高级-通用Mapper学习笔记

    通用 Mapper 笔记 1 引入 1.1作用 替我们生成常用增删改查操作的 SQL 语句. 1.2代码官方发布地址 https://gitee.com/free https://gitee.com/ ...

  2. ElasticSearch基本概念阐述

    下面阐述一下ES当中的一些常见词语含义: 集群 集群由一个或多个节点组成,对外提供服务,索引和搜索功能.在所有的节点中,一个集群有一个唯一的名称默认为“ElasticSearch”,此名称很重要,因为 ...

  3. linux7 grub配置文件 linux6 grub配置文件

    在 grub 的 kernel 配置后面,添加 acpi_pad.disable=1 重启机器之后,开机就不会自动加载 acpi_pad 模块 一:linux6 [root@node2 ~]# cat ...

  4. set unused

    使用 set unused 选项标记不再使用的列 使用 drop unsused columns 丢弃标记为unused的列 alter table tabName set unused column ...

  5. CF429E Points and Segments

    链接 CF429E Points and Segments 给定\(n\)条线段,然后给这些线段红蓝染色,求最后直线上上任意一个点被蓝色及红色线段覆盖次数之差的绝对值不大于\(1\),构造方案,\(n ...

  6. springboot--异步执行的方法及定时执行的方法

    让方法被调用后异步的执行 一般来说,要异步执行一个任务都是创建一个线程来专门干这个任务.在springboot中有 @Async 这个注解快速实现方法的异步执行.只需要两步:第一步: 在启动类上加上@ ...

  7. R reticulate 设置 python 环境

    library("reticulate") use_python("/usr/bin/python", required = T) py_config() 注意 ...

  8. [转]php判断mysql_query是否成功执行

    针对update 语句等会对数据表进行修改的语句 在mysql_query($sql);后面加上 $result = mysql_affected_rows(); 如果$result 值为-1表明语句 ...

  9. shiro安全框架学习-1

    1. apche shiro 是Java的一个安全)框架 2.shiro可以非常容易的开发出足够好的应用,不仅可以在JavaSE环境,也可用在JavaEE环境 3. shiro可以完成 认证,授权,加 ...

  10. Python_007(深浅拷贝)

    一.基础数据类型的补充 1.其他类型之间的相互转换 例如:str = int(str) str => int; int = list(int) int => list;  tuple = ...