当前位置:网站首页>将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语法。
边栏推荐
- 设置状态栏样式Demo
- Data storage (1)
- 中国固态氧化物燃料电池技术进展与发展前景报告(2022版)
- Xiaoman network model & http1-http2 & browser cache
- GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
- Management background --2 Classification list
- 【10点公开课】:视频质量评价基础与实践
- [线性代数] 1.3 n阶行列式
- 经纪xx系统节点VIP案例介绍和深入分析异常
- HDR image reconstruction from a single exposure using deep CNNs阅读札记
猜你喜欢

Unity3d minigame-unity-webgl-transform插件转换微信小游戏报错To use dlopen, you need to use Emscripten‘s...问题

GPS从入门到放弃(十五)、DCB差分码偏差

Oracle-控制文件及日志文件的管理

Leetcode question brushing (XI) -- sequential questions brushing 51 to 55

Seata aggregates at, TCC, Saga and XA transaction modes to create a one-stop distributed transaction solution

2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
![[Digital IC hand tearing code] Verilog burr free clock switching circuit | topic | principle | design | simulation](/img/2b/15b3d831bba6aa772ad83f3ac91d23.png)
[Digital IC hand tearing code] Verilog burr free clock switching circuit | topic | principle | design | simulation

GPS from entry to abandonment (XIV), ionospheric delay
Learn the principle of database kernel from Oracle log parsing

RESNET rs: Google takes the lead in tuning RESNET, and its performance comprehensively surpasses efficientnet series | 2021 arXiv
随机推荐
[sciter bug] multi line hiding
GPS from getting started to giving up (16), satellite clock error and satellite ephemeris error
3DMax指定面贴图
Write a rotation verification code annotation gadget with aardio
GPS from getting started to giving up (XX), antenna offset
Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)
Problems in the process of opencv300 cmake generating project
i.mx6ull搭建boa服务器详解及其中遇到的一些问题
Maximum product of three numbers in question 628 of Li Kou
Assembly and interface technology experiment 5-8259 interrupt experiment
GPS from entry to abandonment (XIV), ionospheric delay
【sciter】: 基于 sciter 封装通知栏组件
Attack and defense world ditf Misc
HDU 4912 paths on the tree (lca+)
GNN,请你的网络层数再深一点~
What is the difference between animators and animators- What is the difference between an Animator and an Animation?
GPS from getting started to giving up (XIII), receiver autonomous integrity monitoring (RAIM)
Oracle-控制文件及日志文件的管理
小满网络模型&http1-http2 &浏览器缓存
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)