mysql完整备份时过滤掉某些库
mysql进行完整备份时使用--all-database参数
比如:
#mysqldump -u root -h localhost -p --all-database > /root/all.sql
数据导入的时候,可以先登陆mysql数据库中,使用source /root/all.sql进行导入。
问题:
想要在mysqldump备份数据库的时候,过滤掉某些库。
这种情况mysqldump备份的时候就不能使用--all-database了,而是使用--database。
如下:备份数据库的时候过滤掉information_schema、mysql 、test和jkhw_db库
[root@fangfull-backup ~]# mysql -uroot -p -e "show databases"
Enter password:
+--------------------+
| Database |
+--------------------+
| information_schema |
| hqsb_db |
| jkhw_db |
| mysql |
| test |
| tech_db |
| hqtime_o2o_db |
| hq_o2o_db |
| hqtime_o2o_db_new |
+--------------------+
9 rows in set (0.00 sec)
操作方法:
[root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|jkhw_db"
Enter password:
hqsb_db
tech_db
hqtime_o2o_db
hq_o2o_db
hqtime_o2o_db_new
[root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|jkhw_db"|xargs
Enter password:
hqsb_db tech_db hqtime_o2o_db hq_o2o_db hqtime_o2o_db_new
[root@fangfull-backup ~]# mysql -uroot -p -e "show databases"|grep -Ev "Database|information_schema|mysql|test|jkhw_db"|xargs mysqldump -uroot -p --databases > mysql_dump.sql
Enter password:
mysql完整备份时过滤掉某些库的更多相关文章
- 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 完整备份和恢复
mysql 完整备份和恢复 一.MySQL完整备份操作 1.直接打包数据库文件夹 创建数据库auth: MariaDB [(none)]> create database auth;Quer ...
- 在给mysql数据库备份时,报错: mysqldump: Got error: 145: Table '.\shengdaxcom\pre_forum_thread' is marked as c rashed and should be repaired when using LOCK TABLES
在给mysql数据库备份时,报错: mysqldump: Got error: 145: Table '.\shengdaxcom\pre_forum_thread' is marked as cra ...
- mysql 恢复备份时出错 Unknown command ‘\”
今天恢复mysql备份时,出现了Unknown command ‘\”这样的错误,原以为是备份文件出错,重新备份导入时还是出错.研究了一凡是因为编码的问题,解决方案如下: 使用你导出备份时的编码重新导 ...
- MySQL完整备份,还原
# 备份 添加编码 --default-character-set=utf8 防止中文乱码 把.sql文件导入MySQL, 汉字出现乱码?在.sql文件头中添加:set names 'gbk'; 或 ...
- Percona Xtrabackup备份mysql全库及指定数据库(完整备份与增量备份)
原文地址:http://www.tuicool.com/articles/RZRnq2 Xtrabackup简介 Percona XtraBackup是开源免费的MySQL数据库热备份软件,它能对In ...
- Percona备份mysql全库及指定数据库(完整备份与增量备份)
Percona Xtrabackup备份mysql全库及指定数据库(完整备份与增量备份) Xtrabackup简介 Percona XtraBackup是开源免费的MySQL数据库热备份软件,它能对I ...
- Percona Xtrabackup备份mysql大数据库(完整备份与增量备份)
Percona Xtrabackup备份mysql大数据库(完整备份与增量备份) 文章目录 [隐藏] Xtrabackup简介 Xtrabackup安装 Xtrabackup工具介绍 inno ...
- mysql完整备份与恢复
1.备份单个数据库 mysql数据库自带了一个很好用的备份命令,就是mysqldump,他的基本使用如下: 语法:mysqldump -u 用户名 -p 数据库名 > 备份的文件名 备份一 1. ...
随机推荐
- 用css伪类实现提示框效果
题目要求用css实现下图效果: 很明显难点就在那个多出去的三角形上,下面代码是用一个div来实现的,用到了伪类 : befor和 : after,使用这两个伪类活生生的在div之前和之后多出了&quo ...
- FIM 2010: Kerberos Authentication Setup
The goal of this article is to provide some background information regarding the Kerberos related co ...
- Sizing and Capacity Planning for SharePoint 2013 - Resources
http://blogs.msdn.com/b/sanjaynarang/archive/2013/04/06/sizing-and-capacity-planning-for-sharepoint- ...
- 编译hadoop eclipse的插件(hadoop1.0)
原创文章,转载请注明: 转载自工学1号馆 欢迎关注我的个人博客:www.wuyudong.com, 更多云计算与大数据的精彩文章 在hadoop-1.0中,不像0.20.2版本,有现成的eclipse ...
- 部分博文目录索引(C语言+算法)
今天将本博客的部分文章建立一个索引,方便大家进行阅读,当然每一类别中的文章都会持续的添加和更新(PS:博文主要使用C语言) 博客地址:http://www.cnblogs.com/archimedes ...
- 朝花夕拾-android 一个注册新用户时,多步填写用户资料的框架
源码地址:http://git.oschina.net/zj2012zy/Android-Demo/tree/master/AndroidDemo/setpregister 效果如下: 基本思路: 1 ...
- Objective-C之用C的字符来处理NSString相关的字符替换和拼接的问题
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- 小波说雨燕 第三季 构建 swift UI 之 UI组件集-视图集(六)Picker View视图 学习笔记
想对PickerView进行操作,只能在代码中操作. 下面 ,再添加三个label组件,然后将所有组件配置到代码中(看代码),然后要实现对PickerView的操作,就要实现它的DataSource协 ...
- CentOS下如何完全卸载MySQL?卸载自带的mysql
CentOS下如何完全卸载MySQL?解决卸载不干净的问题 系统:CentOS 6.5,MySQL:MySql 5.6 这里主要解决使用rpm安装的卸载问题,安装方法见:CentOS安装mysql*. ...
- Sql practice
employee表 数据准备 use tempdb go if OBJECT_ID('employee') is not null drop table employee ;with employee ...