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 ...
随机推荐
- 读取FTP上的excel文件,并写入数据库
今天遇到一些问题,需要从ftp上读取一些excel文件,并需要将excel中的数据写入到数据库,这样就可以通过管理页面查看这些数据. 我将相关工作分为三步,1.从ftp上读取相关文件,并将excel文 ...
- uboot tag存储主要部分代码
https://www.cnblogs.com/pokerface/p/5217106.html cmd_bootm.c //传递给内核的参数 int do_bootm (cmd_t ...
- 占卜DIY
题目地址 Code #include<iostream> #include<vector> #include<map> using namespace std; s ...
- Altium Designer 19 导出光绘文件
一.点击 文件--制造输出--Gerber Files 第一次设置如下 绘制层点击进去全选 钻孔光圈 符号大小50mil 生成文件 关闭不用保存 蚀刻图 二.点击 文件--制造输出--Gerber F ...
- [BZOJ1826] 缓存交换
问题描述 在计算机中,CPU只能和高速缓存Cache直接交换数据.当所需的内存单元不在Cache中时,则需要从主存里把数据调入Cache.此时,如果Cache容量已满,则必须先从中删除一个. 例如,当 ...
- QTimer不能同时使用两个,用QTimerEvent (QT)
最近写程序的时候有个界面想定两个QTimer定时器,不同时间干不同的事: QTimer *timer1 = new QTimer(this); QTimer *timer2 = new QTimer( ...
- python绘制图的度分布柱状图, draw graph degree histogram with Python
图的度数分布 import collections import matplotlib.pyplot as plt import networkx as nx G = nx.gnp_random_gr ...
- 配置Android Studio
1.去gradle官网下载gradle,gradle的版本可以在C:\Program Files\Android\Android Studio\gradle下看到 2.新建一个项目,退出后把下载好的g ...
- C语言的结构体的具体作用是?
在实际问题中,一组数据往往具有不同的数据类型.例如,在学生登记表中,姓名应为字符型:学号可为整型或字符型:年龄应为整型:性别应为字符型:成绩可为整型或实型.显然不能用一个数组来存放这一组数据.因为数组 ...
- 多个webView嵌套在UIScrollView里面内存优化
之前一直纠结在使用UIWebView上,发现加载6个UIWebView占用了290M左右内存,切换时还会增加.后来看到一篇文章:http://blog.csdn.net/kongu/article/d ...