当前位置:网站首页>将MySQL的表数据纯净方式导出
将MySQL的表数据纯净方式导出
2022-07-06 14:28:00 【枫叶梨花】
有时候我想导表,就是将一张表的数据导出,然后导入到另外一张表,但是直接使用mysqldump这个命令导出来的表数据,不够干净,不能直接导入,所以使用一些参数过滤信息。以下语句即可干净导出数据
mysqldump -uroot -h 127.0.0.1 -proot --databases test --tables user_info --where "id > 3" --default-character-set gbk --skip-comments --no-create-info --no-create-db --skip-add-drop-table --skip-add-locks --skip-disable-keys --skip-extended-insert --set-gtid-purged=off -c > C:\Users\Breeze\Desktop\test.sql
原表数据
导出的SQL文件数据
/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES gbk */;
/*!40103 SET @[email protected]@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `user_info` (`id`, `name`, `age`) VALUES (4,'Dave',24);
INSERT INTO `user_info` (`id`, `name`, `age`) VALUES (5,'Eva',24);
INSERT INTO `user_info` (`id`, `name`, `age`) VALUES (6,'Maybe',27);
/*!40103 SET [email protected]_TIME_ZONE */;
/*!40101 SET [email protected]_SQL_MODE */;
/*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
/*!40014 SET [email protected]_UNIQUE_CHECKS */;
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
/*!40101 SET [email protected]_COLLATION_CONNECTION */;
/*!40111 SET [email protected]_SQL_NOTES */;
上述的SQL文件即比较干净的SQL脚本语句
--default-character-set gbk设置编码集,防止中文数据乱码--skip-comments取消附加注释信息--no-create-info只导出数据,不导出建表语句--no-create-db只导出数据,不导出建库语句--skip-add-drop-table跳过drop语句-skip-add-locks取消在每个表导出之前增加LOCK TABLES--skip-disable-keys导出更少的输出信息(用于调试)。去掉注释和头尾等结构。可以使用选项:--skip-add-drop-table --skip-add-locks --skip-comments --skip-disable-keys--skip-extended-insert使用具有多个VALUES列的INSERT语法。
边栏推荐
- Force buckle 575 Divide candy
- Adjustable DC power supply based on LM317
- GPS从入门到放弃(十二)、 多普勒定速
- Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
- HDR image reconstruction from a single exposure using deep CNN reading notes
- What a new company needs to practice and pay attention to
- GPS from getting started to giving up (XI), differential GPS
- MariaDB database management system learning (I) installation diagram
- 微信红包封面小程序源码-后台独立版-带测评积分功能源码
- Seata aggregates at, TCC, Saga and XA transaction modes to create a one-stop distributed transaction solution
猜你喜欢

Chapter 4: talk about class loader again

Management background --1 Create classification

labelimg的安装与使用
Learn the principle of database kernel from Oracle log parsing

HDR image reconstruction from a single exposure using deep CNNs阅读札记

About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness

Write a rotation verification code annotation gadget with aardio
![[10:00 public class]: basis and practice of video quality evaluation](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[10:00 public class]: basis and practice of video quality evaluation

GPS从入门到放弃(十二)、 多普勒定速

3DMAX assign face map
随机推荐
小常识:保险中的“保全”是什么?
MariaDb数据库管理系统的学习(一)安装示意图
每日一题:力扣:225:用队列实现栈
Unity3d Learning Notes 6 - GPU instantiation (1)
GNN, please deepen your network layer~
Save and retrieve strings
图像的spatial domain 和 frequency domain 图像压缩
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
Learn the principle of database kernel from Oracle log parsing
Four data streams of grpc
Management background --2 Classification list
Oracle性能分析3:TKPROF简介
The nearest common ancestor of binary (search) tree ●●
Seata aggregates at, TCC, Saga and XA transaction modes to create a one-stop distributed transaction solution
CCNA Cisco network EIGRP protocol
硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
Qt | UDP广播通信、简单使用案例
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
[sciter bug] multi line hiding
Memorabilia of domestic database in June 2022 - ink Sky Wheel