【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 ...
随机推荐
- for循环用了那么多次,但你真的了解它么?
一.基础的for循环 0.使用while也是一种循环方式,此处探究for相关的循环,就不做拓展了. 1.遍历数组的时候,初学时是使用的如下样式的for循环: for(int i=0;i<a.le ...
- Docker容器 MySQL中文乱码解决方案
docker exec进入容器 sudo docker exec -it 588340b778f6 bash 执行以下命令,将 character-set-server=utf8 写入mysql配置文 ...
- Abp vNext框架 从空项目开始 使用ASP.NET Core Web Application-笔记
参考 Abp vNext框架 从空项目开始 使用ASP.NET Core Web Application http://www.vnfan.com/helinbin/d/745b1e040c9b4f6 ...
- Java生鲜电商平台-高并发核心技术订单与库存实战
Java生鲜电商平台-高并发核心技术订单与库存实战 一. 问题 一件商品只有100个库存,现在有1000或者更多的用户来购买,每个用户计划同时购买1个到几个不等商品. 如何保证库存在高并发的场景下是安 ...
- C++ 成员对象和封闭类
01 成员对象与封闭类 类里有其他对象则该对象叫成员对象:有成员对象的类叫 封闭类: class CTyre // 轮胎类 { public: // 有参数构造函数 // 初始化成员变量m_radiu ...
- 模仿UIApplication创建单例
UIApplicationMain: 1.创建UIApplication--应用程序唯一标识:可设置状态栏.识别联网状态.设置数字.打电话.发邮件.发短信.打开网页 2.创建UIApplication ...
- emmet的用法
emmet 是一个提高前端开发效率的一个工具.emmet允许在html.xml.和css等文档中输入缩写,然后按tab键自动展开为完整的代码片段. 一.Sublime Text 3 安装插件Emmet ...
- MySQL基础之数据管理【3】
MySQL中的多表联查 --查询emp的id username age depName create table emp( id int unsigned auto_increment key, us ...
- [b0002] Hadoop HDFS cmd常用命令练手
目的: 学会HDFS CLI 常用操作 环境: Hadoop 2.6.4 伪分布式版 环境搭建参考本博客前篇文章: 伪分布式 hadoop 2.6.4 帮助: hadoop@ssmaster:~$ h ...
- Angular 学习笔记(一)
什么是 Angular: Angular 是一个 JavaScript 框架,可通过 <script> 标签添加到 HTML 页面,然后通过指令扩展 HTML,且通过表达式绑定数据到 HT ...