Mysql 按行dump出数据

时间:2021-05-27 03:33:42
mysqldump -u${user} -p${passwd} --skip-extended-insert --database ${dbname} --table ${tablename} > ${tablename}.sql

用以上语句导出的sql文件中,每条数据都按照一个INSERT语句来保存,方便用版本比较工具按行比较数据差异

例如

INSERT INTO `goods` VALUES (2,1049600,1,0,'604800:88888:-1:-1:-1:-1:-1|',1464408000,1467019659,0,'');
INSERT INTO `goods` VALUES (4,1049600,1,0,'604800:88888:-1:-1:-1:-1:-1|',1464408000,1467019659,0,'');
INSERT INTO `goods` VALUES (7,1049600,1,0,'604800:88888:-1:-1:-1:-1:-1|',1464408000,1467019659,0,'');
INSERT INTO `goods` VALUES (8,1049600,1,0,'604800:88888:-1:-1:-1:-1:-1|',1464408000,1467019659,0,'');