在对mysql进行完整备份时使用--all-database参数

  1. # 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库

  1. [root@fangfull-backup ~]# mysql -uroot -p -e "show databases"
  2. Enter password:
  3.  
  4. +--------------------+
  5. | Database |
  6. +--------------------+
  7. | information_schema |
  8. | haha_db |
  9. | hehe_db |
  10. | mysql |
  11. | test |
  12. | tech_db |
  13. | yaya_db |
  14. | mimi_db |
  15. | lala_db |
  16. +--------------------+
  17. 9 rows in set (0.00 sec)
  18.  
  19. [root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|hehe_db"
  20. Enter password:
  21. haha_db
  22. tech_db
  23. yaya_db
  24. mimi_db
  25. lala_db
  26.  
  27. [root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|hehe_db"|xargs
  28. Enter password:
  29. haha_db tech_db yaya_db mimi_db lala_db
  30.  
  31. [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
  32. Enter password:

mysql5.6以上版本在直接使用密码登录mysql的时候,会出现提示信息"Warning: Using a password on the command line interface can be insecure."!

  1. [root@kevin ~]# mysql -pkevin@123 -e "show databases"
  2. Warning: Using a password on the command line interface can be insecure.
  3. +--------------------+
  4. | Database |
  5. +--------------------+
  6. | information_schema |
  7. | confluence |
  8. | dtin_uat |
  9. | dtinlog_uat |
  10. | mysql |
  11. | nextcloud_db |
  12. | performance_schema |
  13. | xbtdb |
  14. +--------------------+

要想屏蔽掉这个提示信息,方法是:将提示信息重定向到/dev/null,即忽略掉提示信息。

  1. [root@kevin ~]# mysql -pkevin@123 -e "show databases" 2>/dev/null
  2. +--------------------+
  3. | Database |
  4. +--------------------+
  5. | information_schema |
  6. | confluence |
  7. | dtin_uat |
  8. | dtinlog_uat |
  9. | mysql |
  10. | nextcloud_db |
  11. | performance_schema |
  12. | xbtdb |
  13. +--------------------+
  14.  
  15. 过滤掉mysql某些库的操作如下:
  16. [root@kevin ~]# mysql -pkevin@123 -e "show databases" 2>/dev/null |grep -Ev "Database|information_schema|mysql"
  17. confluence
  18. dtin_uat
  19. dtinlog_uat
  20. nextcloud_db
  21. performance_schema
  22. xbtdb

mysql备份时过滤掉某些库 以及 去掉"Warning: Using a password on the command line interface can be insecure."提示信息的更多相关文章

  1. 【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.”在命令行使用密码不安全警 ...

  2. mysql 备份报错mysqldump: [Warning] Using a password on the command line interface can be insecure.

    -------------------------------------------------------------------------------- mysql 备份报错mysqldump ...

  3. Centos下_MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.

    在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...

  4. MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.

    在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...

  5. 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 ...

  6. 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 ...

  7. 数据库备份出现警告: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 ...

  8. MYSQL报警:Warning: Using a password on the command line interface can be insecure.

    问题描述:执行下面的语句,sql是执行成功了,但是出现了一个报警,报警看上去始终不舒服 mysql -hip -Pport -uuser -ppassword -e "use db;dele ...

  9. 解决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 ...

随机推荐

  1. MAC OS 10.15 挂载ntfs文件系统并设置自动挂载RW模式.

    解决方案 花钱的,省心的 https://www.paragon-software.com/home/ntfs-mac/ 免费的 开源的 https://github.com/osxfuse/osxf ...

  2. MySQL 基础之一

    为了满足关系范式:通常一个大的数据集会拆成在一个库(集合内)中多张表表来存储,每一张表就是由行和列组成的二维关系,表与表之间也有关系,查询有时候需要做表链接,而表链接这个过程需要依赖于索引到各种算法来 ...

  3. Spring|@Autowired与new的区别

    前两天写代码的时候遇到一个问题,通过new出来的对象,自动注入的属性总是报空指针的错误.到网上查了资料,才发现问题所在,同时也加深了自己对于容器IOC的理解.现在把这个问题记录一下,仅供大家参考. [ ...

  4. Oracle表空间 与 分页

    目录 Oracle表空间 表空间的构建以及数据文件的挂接 创建一个用户,并指定专有的永久表空间和临时表空间 伪列 分页 Oracle表空间 一个表空间可以包含1至n个数据文件 一个数据文件必然属于某个 ...

  5. org.postgresql.util.PSQLException:致命:抱歉,已经有太多客户了(org.postgresql.util.PSQLException: FATAL: sorry, too many clients already)

    我正在尝试连接到Postgresql数据库,我收到以下错误: 错误:org.postgresql.util. PSQLException:致命:抱歉,已经有太多客户 错误是什么意思,我该如何解决? 我 ...

  6. SelectKBest

    https://www.e-learn.cn/content/python/2198918from sklearn.feature_selection import SelectKBest,f_cla ...

  7. lnmp新增https访问【转】

    环境是使用lnmp一键安装包搭建的: 1 首先去这个网站下载证书:免费ssl证书 最终会得到两个文件 2:在/usr/local/nginx/conf创建cert目录把这两个文件放进去,这个地址后面有 ...

  8. GIS地理工具案例教程——栅格分割

    GIS地理工具案例教程--栅格分割 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 目的:利用多边形要素类去分割栅格,每个多边形裁剪出对应的范围 ...

  9. 漫谈企业应用架构的演变 CRM & etc

    漫谈企业应用架构的演变 goYangKunhttps://mp.weixin.qq.com/s?__biz=MzIzMTc3NTA2NQ==&mid=2247483698&idx=1& ...

  10. ModSecurity:一款优秀的开源WAF

    一.ModSecurity3.0介绍 ModSecurity是一个开源的跨平台Web应用程序防火墙(WAF)引擎,用于Apache,IIS和Nginx,由Trustwave的SpiderLabs开发. ...