当前位置:网站首页>将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语法。
边栏推荐
- GPS从入门到放弃(十八)、多路径效应
- Four data streams of grpc
- GNN,请你的网络层数再深一点~
- ZABBIX proxy server and ZABBIX SNMP monitoring
- GPS from getting started to giving up (XI), differential GPS
- Data processing skills (7): MATLAB reads the data in the text file TXT with mixed digital strings
- GPS从入门到放弃(十五)、DCB差分码偏差
- 嵌入式常用计算神器EXCEL,欢迎各位推荐技巧,以保持文档持续更新,为其他人提供便利
- QT | UDP broadcast communication, simple use case
- Shell product written examination related
猜你喜欢
[leetcode daily clock in] 1020 Number of enclaves
【数字IC手撕代码】Verilog无毛刺时钟切换电路|题目|原理|设计|仿真
GPS from getting started to giving up (19), precise ephemeris (SP3 format)
2500 common Chinese characters + 130 common Chinese and English characters
HDR image reconstruction from a single exposure using deep CNN reading notes
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
Search element topic (DFS)
[线性代数] 1.3 n阶行列式
HDR image reconstruction from a single exposure using deep CNNs阅读札记
A Mexican airliner bound for the United States was struck by lightning after taking off and then returned safely
随机推荐
HDU 4912 paths on the tree (lca+)
GPS from entry to abandonment (XIV), ionospheric delay
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
Insert sort and Hill sort
[10:00 public class]: basis and practice of video quality evaluation
Oracle Performance Analysis 3: introduction to tkprof
基于LM317的可调直流电源
414. The third largest digital buckle
做接口测试都测什么?有哪些通用测试点?
Management background --1 Create classification
Some problems about the use of char[] array assignment through scanf..
Spatial domain and frequency domain image compression of images
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
[leetcode daily clock in] 1020 Number of enclaves
图像的spatial domain 和 frequency domain 图像压缩
GPS从入门到放弃(十八)、多路径效应
Xiaoman network model & http1-http2 & browser cache
ResNet-RS:谷歌领衔调优ResNet,性能全面超越EfficientNet系列 | 2021 arxiv
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
Anaconda installs third-party packages