【mysql报错】MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”
MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”在命令行使用密码不安全警告
原因
这个错误是在我执行备份脚本的时候出现的
# mysqldump -h主机名 -u用户名 -p密码 数据库名称 > /usr/local/dbbackup/数据库名称_$(date +%Y%m%d_%H%M%S).sql
原因是mysql的安全机制导致,因为在命令行直接将命令写上,被认为是不安全的行为
mysqldump: [Warning] Using a password on the command line interface can be insecure.
虽然会报错,但是并不影响是数据库的备份
解决方法
方法一:修改my.cnf配置文件
编辑/etc/my.cnf配置文件
[root@localhost local]# vi /etc/my.cnf
在配置文件中添加如下内容
[client]
port =
socket = /tmp/mysql.sock
default-character-set = utf8mb4
host = 主机ip
user = 数据库用户名
password = '数据库密码'
使用命令导入导出(指定加载配置文件)
#导出数据库
mysqldump --defaults-extra-file=/etc/my.cnf 数据库名称 > 数据库名称_$(date +%Y%m%d_%H%M%S).sql
#导入数据库
mysql --defaults-extra-file=/etc/my.cnf 数据库名称 < 数据库名称_$(date +%Y%m%d_%H%M%S).sql
方法二:直接在linux环境中添加mysql环境
编辑/etc/profile配置文件
[root@localhost local]# vi /etc/profile
在最后面添加如下内容,保存并退出
export MYSQL_PWD=数据库密码
使配置生效
[root@localhost local]# source /etc/profile
使用mysqldump命令备份数据库的时候就可以省略-p密码参数,执行脚本就不会报错了
# mysqldump -h主机名 -u用户名 数据库名称 > /usr/local/dbbackup/数据库名称_$(date +%Y%m%d_%H%M%S).sql
【mysql报错】MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”的更多相关文章
- mysql 备份报错mysqldump: [Warning] Using a password on the command line interface can be insecure.
-------------------------------------------------------------------------------- mysql 备份报错mysqldump ...
- MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.
在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...
- Centos下_MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.
在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...
- 解决mysql连接输入密码提示Warning: Using a password on the command line interface can be insecure
有时候客户端连接mysql需要指定密码时(如用zabbix监控mysql)5.6后数据库会给出个警告信息 mysql -uroot -pxxxx Warning: Using a password o ...
- mysql备份时过滤掉某些库 以及 去掉"Warning: Using a password on the command line interface can be insecure."提示信息
在对mysql进行完整备份时使用--all-database参数 # mysqldump -u root -h localhost -p --all-database > /root/all.s ...
- 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 ...
- 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" 登陆 ...
- 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.
问题描述:执行下面的语句,sql是执行成功了,但是出现了一个报警,报警看上去始终不舒服 mysql -hip -Pport -uuser -ppassword -e "use db;dele ...
随机推荐
- 关于unittest单元测试框架中常用的几种用例加载方法
unittest模块是Python自带的一个单元测试模块,我们可以用来做单元测试.unittest模块包含了如下几个子模块: 测试用例:TestCase 测试集:TestSuite 加载用例:Test ...
- Nginx超时设定
最近针对公司的goscon网关发了一个PR,新增了握手阶段的超时判定.现在回顾一下Nginx的所有超时判定,看看目前还缺少哪些判定 ngx_http_core_module包含的timeout: cl ...
- java获取下一天的日期
我们来看看Java怎么获取下一天的日期: 哈哈哈,开玩笑啦,这个只是个段子. "哪怕悲伤有1000种,快乐有1种就够了."
- 常用regex正则表达式
[单个]字符匹配 任意字符:表示由任意字符组成 \\:匹配一个'\' \n:匹配换行 \t:匹配制表符 [单个]字符集(可以从里面任选一个字符) [abc]:可以是字母abc中任意一个 [^abc]: ...
- python字典的常用方法
1.clear()方法: clear() 用于清空字典中所有的 key-value 对,对一个字典执行 clear() 方法之后,该字典就会变成一个空字典. s = {'a': 1, 'b': 2, ...
- AllowsTransparency="True" 怎么放大缩小窗体
后台都不用写任何代码! xaml: <Window x:Class="TestNoBorderWindow" xmlns="http://schem ...
- 教你如何用Python向手机发送通知
------------恢复内容开始------------ 你曾想尝试在服务器端或电脑上向手机发送通知吗? 你曾烦恼过企业邮箱的防骚扰机制吗? 现在,我们可以用一种简单轻松的方法来代替企业邮箱了! ...
- [转]English - 开口说话工具箱: 27个高频词单词
本文转自:https://blog.csdn.net/weixin_34247032/article/details/87125465 英语初学者注意力不要放在语法上, 首先要懂得如何让自己开口说英语 ...
- [转]Oracle 11g R2 RAC高可用连接特性 – SCAN详解
原文地址:http://czmmiao.iteye.com/blog/2124373 昨天帮朋友解决11g RAC SCAN问题,当时为这朋友简单解答了一些SCAN特性相关的问题,但我知道这仅仅是 ...
- 新MySQL查询和删除重复记录
在工作中,我们经常会发现表中会存在重复数据,那么如何找出和删除这些数据呢? 下面,以一个小例子来说明: 1.创建学生表 1 CREATE TABLE student( 2 id INT PRIMARY ...