当前位置:网站首页>将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语法。
边栏推荐
- Insert sort and Hill sort
- GPS from getting started to giving up (XV), DCB differential code deviation
- 2021 geometry deep learning master Michael Bronstein long article analysis
- GPS从入门到放弃(十四)、电离层延时
- [MySQL] online DDL details
- Barcodex (ActiveX print control) v5.3.0.80 free version
- Make menuconfig has a recipe for target 'menuconfig' failed error
- BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用
- Assembly and interface technology experiment 5-8259 interrupt experiment
- 2500个常用中文字符 + 130常用中英文字符
猜你喜欢
Wechat red envelope cover applet source code - background independent version - source code with evaluation points function
二叉(搜索)树的最近公共祖先 ●●
Oracle-控制文件及日志文件的管理
How does the uni admin basic framework close the creation of super administrator entries?
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
[sciter]: encapsulate the notification bar component based on sciter
[线性代数] 1.3 n阶行列式
Memorabilia of domestic database in June 2022 - ink Sky Wheel
3DMax指定面贴图
Management background --2 Classification list
随机推荐
Embedded common computing artifact excel, welcome to recommend skills to keep the document constantly updated and provide convenience for others
Common sense: what is "preservation" in insurance?
hdu 4912 Paths on the tree(lca+馋)
MongoDB(三)——CRUD
中国1,4-环己烷二甲醇(CHDM)行业调研与投资决策报告(2022版)
GPS from getting started to giving up (XI), differential GPS
AI enterprise multi cloud storage architecture practice | Shenzhen potential technology sharing
Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
[10:00 public class]: basis and practice of video quality evaluation
小满网络模型&http1-http2 &浏览器缓存
Barcodex (ActiveX print control) v5.3.0.80 free version
【sciter Bug篇】多行隐藏
Codeforces Round #274 (Div. 2) –A Expression
OpenCV300 CMake生成project在项目过程中的问题
12、 Start process
PVL EDI project case
GNN,请你的网络层数再深一点~
lora同步字设置
Data processing skills (7): MATLAB reads the data in the text file TXT with mixed digital strings
Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1