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 ...
随机推荐
- MAC OS 10.15 挂载ntfs文件系统并设置自动挂载RW模式.
解决方案 花钱的,省心的 https://www.paragon-software.com/home/ntfs-mac/ 免费的 开源的 https://github.com/osxfuse/osxf ...
- MySQL 基础之一
为了满足关系范式:通常一个大的数据集会拆成在一个库(集合内)中多张表表来存储,每一张表就是由行和列组成的二维关系,表与表之间也有关系,查询有时候需要做表链接,而表链接这个过程需要依赖于索引到各种算法来 ...
- Spring|@Autowired与new的区别
前两天写代码的时候遇到一个问题,通过new出来的对象,自动注入的属性总是报空指针的错误.到网上查了资料,才发现问题所在,同时也加深了自己对于容器IOC的理解.现在把这个问题记录一下,仅供大家参考. [ ...
- Oracle表空间 与 分页
目录 Oracle表空间 表空间的构建以及数据文件的挂接 创建一个用户,并指定专有的永久表空间和临时表空间 伪列 分页 Oracle表空间 一个表空间可以包含1至n个数据文件 一个数据文件必然属于某个 ...
- org.postgresql.util.PSQLException:致命:抱歉,已经有太多客户了(org.postgresql.util.PSQLException: FATAL: sorry, too many clients already)
我正在尝试连接到Postgresql数据库,我收到以下错误: 错误:org.postgresql.util. PSQLException:致命:抱歉,已经有太多客户 错误是什么意思,我该如何解决? 我 ...
- SelectKBest
https://www.e-learn.cn/content/python/2198918from sklearn.feature_selection import SelectKBest,f_cla ...
- lnmp新增https访问【转】
环境是使用lnmp一键安装包搭建的: 1 首先去这个网站下载证书:免费ssl证书 最终会得到两个文件 2:在/usr/local/nginx/conf创建cert目录把这两个文件放进去,这个地址后面有 ...
- GIS地理工具案例教程——栅格分割
GIS地理工具案例教程--栅格分割 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 目的:利用多边形要素类去分割栅格,每个多边形裁剪出对应的范围 ...
- 漫谈企业应用架构的演变 CRM & etc
漫谈企业应用架构的演变 goYangKunhttps://mp.weixin.qq.com/s?__biz=MzIzMTc3NTA2NQ==&mid=2247483698&idx=1& ...
- ModSecurity:一款优秀的开源WAF
一.ModSecurity3.0介绍 ModSecurity是一个开源的跨平台Web应用程序防火墙(WAF)引擎,用于Apache,IIS和Nginx,由Trustwave的SpiderLabs开发. ...