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.sql
数据导入的时候,可以先登陆mysql数据库中,使用source /root/all.sql进行导入。
如果想要在mysqldump备份数据库时过滤掉某些库,这种情况下就不能使用--all-database了,而是使用--database。如下备份数据库时过滤掉information_schema、mysql 、test和hehe_db库
[root@fangfull-backup ~]# mysql -uroot -p -e "show databases"
Enter password: +--------------------+
| Database |
+--------------------+
| information_schema |
| haha_db |
| hehe_db |
| mysql |
| test |
| tech_db |
| yaya_db |
| mimi_db |
| lala_db |
+--------------------+
9 rows in set (0.00 sec) [root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|hehe_db"
Enter password:
haha_db
tech_db
yaya_db
mimi_db
lala_db [root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|hehe_db"|xargs
Enter password:
haha_db tech_db yaya_db mimi_db lala_db [root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|hehe_db"|xargs mysqldump -uroot -p --databases > mysql_dump.sql
Enter password:
mysql5.6以上版本在直接使用密码登录mysql的时候,会出现提示信息"Warning: Using a password on the command line interface can be insecure."!
[root@kevin ~]# mysql -pkevin@123 -e "show databases"
Warning: Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| confluence |
| dtin_uat |
| dtinlog_uat |
| mysql |
| nextcloud_db |
| performance_schema |
| xbtdb |
+--------------------+
要想屏蔽掉这个提示信息,方法是:将提示信息重定向到/dev/null,即忽略掉提示信息。
[root@kevin ~]# mysql -pkevin@123 -e "show databases" 2>/dev/null
+--------------------+
| Database |
+--------------------+
| information_schema |
| confluence |
| dtin_uat |
| dtinlog_uat |
| mysql |
| nextcloud_db |
| performance_schema |
| xbtdb |
+--------------------+ 过滤掉mysql某些库的操作如下:
[root@kevin ~]# mysql -pkevin@123 -e "show databases" 2>/dev/null |grep -Ev "Database|information_schema|mysql"
confluence
dtin_uat
dtinlog_uat
nextcloud_db
performance_schema
xbtdb
mysql备份时过滤掉某些库 以及 去掉"Warning: Using a password on the command line interface can be insecure."提示信息的更多相关文章
- 【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.”在命令行使用密码不安全警 ...
- mysql 备份报错mysqldump: [Warning] Using a password on the command line interface can be insecure.
-------------------------------------------------------------------------------- mysql 备份报错mysqldump ...
- Centos下_MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.
在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...
- 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." 解决方法
错误重现: 命令行或者shell脚本中执行以下命令,如果您当前服务器mysql版本是大于5.6的,则会出现警告:Warning: Using a password on the command lin ...
- 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 ...
- 数据库备份出现警告:Warning: Using a password on the command line interface can be insecure. Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even thos
1.先来看原备份数据库语句: mysqldump -h 127.0.0.1 -uroot -ppassword database > /usr/microStorage/dbbackup/cap ...
- MYSQL报警:Warning: Using a password on the command line interface can be insecure.
问题描述:执行下面的语句,sql是执行成功了,但是出现了一个报警,报警看上去始终不舒服 mysql -hip -Pport -uuser -ppassword -e "use db;dele ...
- 解决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 ...
随机推荐
- luogu P1046 陶陶摘苹果
二次联通门 : luoguP1046 /* 这个题好难..... 由苹果树可知 这应该是个树结构的题 所以很自然的想到了用树链剖分来搞一下 连边 最后查询以1为根节点的子树的权值和... 从前闲的没事 ...
- threejs行星运动小demo总结
1.动画构思 就是中间有个红太阳,外面有几个行星球体环绕着太阳在各自轨道上做圆周运动.下面是效果图 2.基本要素 使用threejs的基本构件包括:渲染器(renderer),相机(camera),场 ...
- java非空判断
是否为 null 是否为 "" 是否为空字符串(引号中间有空格) 如: " ". 制表符.换行符.换页符和回车 一. 字符串 1. if(str == ...
- html5中time元素详解
html5中time元素详解 一.总结 一句话总结: time的使用的话主要是将时间放在datetime属性里面:<time datetime="2015-10-22"> ...
- JSON HiJacking攻击
JSON劫持类似于CSRF攻击,为了了解这种攻击方式,我们先看一下Web开发中一种常用的跨域获取数据的方式:JSONP. 先说一下JSON吧,JSON是一种数据格式,主要由字典(键值对)和列表两种存在 ...
- CESIUM内置shader变量和函数[转]
cesium中内置了一些常量.变量和函数,在vs和fs中可直接使用. 内置uniform 内置uniform主要置于AutomaticUniforms类里面,该类私有未开放文档. czm_backgr ...
- git 代码版本回退
1.查看 commit id 2.git reset --hard "dfdfdfdf" // commit id 3.git push -f -u origin 2.1.0 // ...
- bower 安装依赖提示 EINVRES Request to https://bower.herokuapp.com/packages/xxx failed with 502
出错提示EINVRES Request to https://bower.herokuapp.com/packages/chai failed with 502 访问 https://bower.he ...
- MWC飞控增加声纳定高的方法(转)
源: MWC飞控增加声纳定高的方法
- Access 字段拼接(UPDATE 数据追加)
今天遇到一个需求,在Access数据库中,有个net_id 字段,它的值是由 “jjgrape” 这个字符串和 id 字段组成的,也就是说,要把 ‘jjgrape’ 和 id 字段拼接起来: 那怎么拼 ...