mysql: "Warning: Using a password on the command line interface can be insecure." 解决方法
错误重现:
命令行或者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." 解决方法的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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'); 最后退出 ...
- 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 ...
- MYSQL报警:Warning: Using a password on the command line interface can be insecure.
问题描述:执行下面的语句,sql是执行成功了,但是出现了一个报警,报警看上去始终不舒服 mysql -hip -Pport -uuser -ppassword -e "use db;dele ...
- 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" 登陆 ...
- 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 ...
- mysql 备份报错mysqldump: [Warning] Using a password on the command line interface can be insecure.
-------------------------------------------------------------------------------- mysql 备份报错mysqldump ...
随机推荐
- 重绘ComboBox —— 让ComboBox多列显示
最近在维护一个winform项目,公司购买的是DevExpress控件 (请问怎么联系DevExpress工作人员? 我想询问下,广告费是怎么给的.:p),经过公司大牛们对DevExpress控件疯狂 ...
- [SheetJS] js-xlsx模块学习指南
简介 SheetJS是前端操作Excel以及类似的二维表的最佳选择之一,而js-xlsx是它的社区版本. js-xlsx将注意力集中到了数据转换和导出上,所以它支持相当多种类的数据解析和导出.不仅仅局 ...
- Vue-cli2项目文件目录解析
前言 不是原创,真的不是原创,主要我是根据CSDN的一篇文章和其他平台上的文章整理而来,在最后我会贴上所有原文的地址,下面正式进入正文. Vue-cli项目文件目录结构 这个是Vue-cli2.0版本 ...
- Linux安装postgresql及基础操作
安装环境说明 系统环境说明 [root@slave1 ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@sl ...
- Robot Framework 源码阅读 day1 run.py
robot里面run起来的接口主要有两类 run_cli def run_cli(arguments): """Command line execution entry ...
- (转)nginx+redis实现接入层高性能缓存技术
转自:https://blog.csdn.net/phil_code/article/details/79154271 1. OpenRestyOpenResty是一个基于 Nginx与 Lua的高性 ...
- idea hibernate console 执行hql报错
报错信息 hql> select a from GDXMZD a[2019-08-29 13:45:01] org.hibernate.service.spi.ServiceException: ...
- ArrayList,Vector, LinkedList的存储性能和特性?
ArrayList,Vector, LinkedList的存储性能和特性? ArrayList 采用的是数组形式来保存对象的,这种方式将对象放在连续的位置中,所以最大的缺点就是插入或删除时非常麻烦. ...
- Qt 倒计时验证码按钮效果
本来还想继承QTimer跟QPushButton去实现,后来发现可以使用两个QTimer来实现: 验证码倒计时间:(60s) 封装到widget类里: 需要这几个数据:Button,TimerA,Ti ...
- FreeRTOS之taskYIELD()
摘自:http://www.mcuchina.com/article/2007/1227/article_59.html 1.taskYIELD() 比如我创建了8个优先级一样的task,并且没有 ...