当前位置:网站首页>将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语法。
边栏推荐
- HDR image reconstruction from a single exposure using deep CNNs阅读札记
- Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
- Lora sync word settings
- hdu 4912 Paths on the tree(lca+馋)
- Spatial domain and frequency domain image compression of images
- GNN, please deepen your network layer~
- Maximum product of three numbers in question 628 of Li Kou
- 【sdx62】WCN685X将bdwlan.bin和bdwlan.txt相互转化操作方法
- Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案
- GPS从入门到放弃(十七) 、对流层延时
猜你喜欢

每日一题:力扣:225:用队列实现栈

2022年6月国产数据库大事记-墨天轮

The nearest common ancestor of binary (search) tree ●●

【数字IC手撕代码】Verilog无毛刺时钟切换电路|题目|原理|设计|仿真

A Mexican airliner bound for the United States was struck by lightning after taking off and then returned safely

UNI-Admin基础框架怎么关闭创建超级管理员入口?

Chapter 4: talk about class loader again
![[sciter]: encapsulate the notification bar component based on sciter](/img/08/a3dd409261054052291e99dd28af11.png)
[sciter]: encapsulate the notification bar component based on sciter

Management background --3, modify classification

GPS from getting started to giving up (XV), DCB differential code deviation
随机推荐
Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)
Codeforces Round #274 (Div. 2) –A Expression
LeetCode刷题(十一)——顺序刷题51至55
VIP case introduction and in-depth analysis of brokerage XX system node exceptions
PVL EDI 项目案例
BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用
GPS from getting started to giving up (16), satellite clock error and satellite ephemeris error
2022年6月国产数据库大事记-墨天轮
CCNA-思科网络 EIGRP协议
中国1,4-环己烷二甲醇(CHDM)行业调研与投资决策报告(2022版)
Mongodb (III) - CRUD
Applet system update prompt, and force the applet to restart and use the new version
UNI-Admin基础框架怎么关闭创建超级管理员入口?
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
Attack and defense world miscall
每日一题:力扣:225:用队列实现栈
anaconda安装第三方包
GPS从入门到放弃(十七) 、对流层延时
3DMAX assign face map
[sciter]: encapsulate the notification bar component based on sciter