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.异常的有效解决方法 阅读详情

 

1.最近把MySQL从5.5升到5.6以后,mysqldump居然不好用了,提示:

 代码如下

复制代码

[root@qttc ~]# /usr/local/mysql/bin/mysqldump  -uroot -proot db > bak.sql
Warning: Using a password on the command line interface can be insecure.

翻译过来是:在命令行界面上使用密码可以是不安全的;

这让人有点郁闷,5.5用的1直都很爽,到5.6居然说命令行方式写密码不安全?那密码写哪呢?

在官网文档找到了缘由,大家可以点击这里看看:

1.官方网址:http://dev.mysql.com/doc/refman/5.1/en/password-security-user.html

MySQL users shoulduse the following guidelines to keep passwords secure.

   When you run a client program to connect to the MySQL server, it is inadvisableto specify your password in a way that exposes it to discovery by other users.The methods you can use to specify your password when you run client programsare listed here, along with an assessment of the risks of each method. Inshort, the safest methods are to have the client program prompt for thepassword or to specify the password in a properly protected option file.

翻译过来大意是在命令行下如果要使用密码可以在执行命令后的提示输入里输入密码,或者在指定的安全文件内指定密码;那安全文件时哪个呢?文档对此给出了答案:

Store your passwordin an option file. For example, on Unix, you can list your password in the[client] section of the .my.cnf file in your home directory:

可以在my.cnf内指定,于是打开我的my.cnf,在[mysqldump]下增加:

 代码如下

复制代码

user=root
password=root

文中说的在[client]下面加也可以,但那样就所有块的操作都能共享了,所以生产环境上为了安全还是尽量分开;保存退出再dump就ok了;

 代码如下

复制代码

[root@qttc ~]# /usr/local/mysql/bin/mysqldump db > bak.sql
[root@qttc ~]#

MySQL 5.6 警告信息 command line interface can be insecure 修复

在命令行输入密码,就会提示这些安全警告信息;

Warning: Using apassword on the command line interface can be insecure.

注:mysql -u root -pPASSWORD 或 mysqldump -u root -pPASSWORD 都会输出这样的警告信息.

1.针对mysql:

mysql -u root -pPASSWORD改成mysql -u root -p 在输入密码即可.

2.mysqldump就比较麻烦了,通常都写在scripts脚本中;

解决方法:

对于mysqldump 要如何避免出现(Warning:Using a password on the command line interface can be insecure.) 警告信息呢?

vim /etc/mysql/my.cnf

[mysqldump]

user=your_backup_user_name

password=your_backup_password

修改完配置文件后, 只需要执行mysqldump 脚本就可以了;备份脚本中不需要涉及用户名密码相关信息;
 

 

问题:

echo "show global status where Variable_name='Questions';" |   mysql -uroot -proot -N

mysql: [Warning] Using a password on the command line interface can be insecure.
Questions    101
 

第一种方式: MYSQL常量;

这种方式其实就是利用常量来代替了明文输入密码的这一步骤, 
使用方法也很简单, 在脚本中加入如下命令即可
---------------------------------------------
export MYSQL_PWD=<password>
---------------------------------------------
之后在脚本中就不用带上 -p参数了, 直接在命令行试试看~

echo "show global status where Variable_name='Questions';" | MYSQL_PWD=root  mysql -uroot -N

 

第二种方式:在配置文件中填写用户名密码方式

通过HOME常量指定配置文件路径,在此路径下创建.my.cnf配置文件并在其中写入账号密码

.my.cnf文件内容
[client]
user=zabbix
host=127.0.0.1
password=123456

 

echo "show global status where Variable_name='Questions';" | HOME=/usr/local/zabbix/etc mysql -N | awk '{print $2}'

mysql 会使用此配置文件中的账号密码登录,也不试试安全警告
 


 

30.7.1 通过mysqladmin修改用户密码 30.7.1 通过mysqladmin修改用户密码 通过mysqladmin即可以修改root用户的密码,也可以修改普通用户的密码。 (1)使用mysqladmin将root用户的密码修改为root。 [root@binghe150 ~]# mysqladmin -u root -h localhost -p password "root" Enter password: ... 阅读详情

相关推荐

mysql登录警告问题的解决方法

一、前言 我们在登录mysql的时候经常会看到一句警告: Warning: Using a password on the command line interface can be insecure. 这让人看着很不舒服,并且当在写脚本的时候这个警告输出到屏幕上更让人感觉难受。 二、解决办法 这个警告是mysql自带的,他是想告诉你在屏幕上直接输入mysql密码并显示是不安全的。 1、解决办法一(看一下就行没有任何用) 这个解决办法相对简单,在你登录mysql的时候-p后面不紧跟任何字符串。   这个解决办法,的确是规避了警告,但是我们如果输入错误,只能重新数据或ctrl+backspac

mysql: [Warning] Using a password on the command line interface can be insecure.异常的解决方案

在使用 MySQL 命令行客户端(CLI)时,如果在命令行中直接提供密码,可能会遇到一个警告信息。这个警告是为了提醒用户,直接在命令行中输入密码可能会存在安全风险,因为其他用户或进程可能能够捕获或查看到这些信息。

2301_79779756的博客 2万+

视觉惯性SLAM系列——ORB-SLAM3的整体介绍及各个线程的功能(五)

跟踪线程(Tracking Thread)作用:负责处理每一帧图像,进行相机位姿的估计和定位。它首先执行与前一帧图像的特征匹配,然后通过仅运动(motion-only)BA(Bundle Adjustment)优化位姿。如果跟踪失败,它会尝试在所有地图中进行重定位。此外,跟踪线程还负责决定何时插入新的关键帧,以及何时将关键帧从局部地图中移除。详细介绍见局部建图线程(Local Mapping Thread)作用:管理局部地图,向活跃地图添加关键帧和点,移除多余的关键帧和点。

曾经也曾立志 1012

mysql 报错:Using a password on the command line interface can be insecure.

意思:在命令行中直接输入密码账号信息是不安全的这个是在MySQL5.6版本以后才出现的出现场景1、登录mysql的时候#mysql -uroot -p数据库密码Using a password on the command line interface can be insecure.解决方式:#mysql -uroot -p   回车,提示输入密码2、在mysqldump中使用#mysqldum...

思考的蜗牛 9万+

我用两个月时间,终于把CSDN付费资源项目玩明白了!

关于项目的定位,这是一个知识付费项目,根据市场研究机构的数据显示,到2023年,全球知识付费市场规模将达到2000亿美元,所以说知识付费的前景是十分广阔的,当下互联网时代信息大爆炸,80后、90后、00后群体对知识付费的认可度也大幅提升,同时这群作为知识付费的主流人群已经具备了更强的消费能力,而且对于知识付费的需求更高。目前整个知识付费领域仍然在发展起步的初期,尽快在知识付费领域布局可以帮助我们在这波红利中获得一份不错的收益。而且个人认为,

白话机器学习 2万+

18、基于FSDD数据集的深度学习案例分析

本文基于FSDD(Free Spoken Digit Dataset)数据集,系统介绍了深度学习在语音数字识别中的应用。内容涵盖动态与静态计算图的对比、数据预处理流程(包括数据增强、固定长度处理和归一化)、监督学习与无监督学习的模型构建与训练过程,并通过实验对比了不同网络架构的性能。文中使用PyTorch实现2层全连接网络和自编码器模型,展示了正则化技术对提升模型准确率的关键作用。最后总结了关键技术并提出了实际应用建议,展望了未来在复杂模型、多模态融合和实时应用方向的发展潜力。

vscode6remote的博客 266

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." 解决方法

10年职场两茫茫,35岁凄凉奈若何 524

【AirPlay】苹果认证MFI学习

配件认证是一个过程,通过这个过程,可验证其配件符合MFi技术规范,并通过苹果指定的任何认证测试。MFi门户中的产品计划 "认证 "页面将指导你完成特定配件所需的认证步骤,并指出何时完成所有要求。在完成所有MFi认证要求之前,你不得制造、分发或销售任何配件。在开始MFi认证过程之前,你必须测试你的配件,以确保它符合最新的MFi技术规范,通过产品计划 "测试计划 "上的所有适用测试,并与它将声称具有兼容性的每个苹果设备兼容。

天天的博客 2287

mysql: [Warning] Using a password on the command line interface can be insecure.解决方法

1.在使用mysql命令的时候,出现问题: https://www.cndba.cn/hbhe0316/article/22635 https://www.cndba.cn/hbhe0316/article/22635https://www.cndba.cn/hbhe0316/article/22635https://www.cndba.cn/hbhe0316/artic...

hbhe0316的专栏 1136

uniapp - 实现安卓App打包上架应用商店详细教程,详解Hbuilder打包编译apk发布上传到应用市场全流程,提供uniApp云打包、离线打包app、原生本地打包,附带APP备案和安卓证书申请

uni-app,安卓,APP,应用商店,打包编译apk,上架到应用市场,如何打包app并发布到主流应用市场,发布为AndroidApp流程,应用备案,如何申请安卓证书,hbuilder发布安卓apk后怎么上传到各家软件商店,创建app证书,uniapp发行原生APP本地打包安卓APK,详细最全的步骤教程,项目打包成apk,云打包,安心打包,安卓app离线打包,一直审核不通过,被拒绝,不符合规范,上架发布失败,申请安卓证书和获取证书信息,uni-app打包发布安卓Android软件到各大应用商店,腾讯应用

🏆 前端领域优质创作者 1万+

CGAL 网格等高线计算

CGAL 网格等高线计算

dayuhaitang1的博客 460

spm on mysql_MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line...

在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下[[emailprotected] mysql_bak]# /usr/local/mysql/bin/mysqldump -uroot -pmyServerPwd# dateabase > /data/mysql_bak/bak_test.sql在执行完了命令本该在指定的目录下出现bak_test...

weixin_36347133的博客 122

腾讯微搭低代码开发实战电子书:医疗挂号小程序

本书通过一个完整的“医疗挂号小程序”项目,深度讲解腾讯微搭(WeDa)低代码平台在复杂业务场景下的实战应用。从登录体系搭建、用户注册,到就诊人管理、科室排班与预约下单,全程遵循“配置+逻辑+实战”的思路,带领读者从零实现具备商业级可用性的医疗挂号小程序,掌握低代码开发的核心技巧与业务落地能力。

低代码布道师的博客 958

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 : 提示:Warning: Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password:

qq_42235737的博客 2万+

Android实战——白天黑夜模式设置

白天黑夜模式是一种动态的UI模式,根据当前时间或用户设置的偏好,在白天和黑夜之间进行切换。它通过调整应用程序的颜色、亮度和其他可视化元素来提供更加舒适和易读的用户界面。

小旭的专栏 5243

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

MySQL5.6 Using a password on the command line interface can be insecure解决方法;

1.最近把MySQL从5.5升到5.6以后,mysqldump居然不好用了,提示:  代码如下 复制代码 [root@qttc ~]# /usr/local/mysql/bin/mysqldump  -uroot -proot db > bak.sql Warning: Using a password on the command line i

geek-wk 10万+

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

[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. 来自TMySQL用户,...

coco3600的博客 1万+

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

Centos7 mysql error: 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. ERROR 1045 (28000) Access denied for user ‘root’@‘localhost’ (using password YES) 翻译:mysql[警告]在命令行界面上使用密码是不安全的。 用户'ro...

Jack_Roy的博客 1万+

mysqldump: [Warning] Using a password on the command line interface can be insecure问题原因及解决方法

问题描述 在5.7版本的mysql环境下通过mysqldump备份数据库时报错: mysqldump: [Warning] Using a password on the command line interface can be insecure 见下图: 问题原因 目前查看资料发现5.5是不报错的,因此此问题可能从5.6开始才有也可能从5.7开始才有 mysql自5.7版本开始,考虑到my...

qq_31851107的博客 2万+

解决mysql出现[Warning] Using a password on the command line interface can be insecure.

登录mysql时出现了错误,在网上找到了几个方法,记录一下 出现的错误: root@37fb7828cff6:/# mysql -uroot -pxd_root mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2002 (HY000): Can't connect to l...

Scar127的博客 1万+

mysql: [Warning] Using a password on the command line interface can be insecure.(using password:YES)

前段时间不知道什么原因在Linux终端中出现无法启动Mysql的情况,在Linux终端中输入 mysql -uroot -p密码 的时候出现了下面这个错误: mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied fo...

weixin_44014228的博客 2万+

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 警告信息 command line interface can be insecure 在命令行输入密码,就会提示这些安全警告信息。 Warning: Using a password on the...

weixin_30439031的博客 4805

已解决: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. 1 解决 将密码改为后置输入

夫君子之行,静以修身,俭以养德,非淡泊无以明志,非宁静无以致远. 4366

mysqldump: [Warning] Using a password on the command line interface can be insecure.问题的解决

之前mysql版本是5.5的,自从升级到5.7后,之前自动备份的命令: /usr/local/mysql/bin/mysqldump -uroot -pmyServerPwd# dateabase > /data/mysql_bak/bak_test.sql 备份出来的SQL文件大小为0,一看就知道有问题了,经过上网搜索后,才发现,相对之前的mysql版本 mysql 5.7对安全性要求更高...

shenxiaomo1688的博客 6870
上一篇: zabbix4 sendEmail发送报警脚本
下一篇: django2 使用pymysql报错
评论 8
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值