[root@ansible ~]# mysqldump -uroot -p123456 xxx > /opt/xxx.sql #备份数据库xxx [root@ansible ~]# egrep -v "#|\*|--|^$" /opt/xxx.sql DROP TABLE IF EXISTS `test`; CREATE TABLE `test` ( `id` int(4) NOT NULL AUTO_INCREMENT, `name` char(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; LOCK TABLES `test` WRITE; INSERT INTO `test` VALUES (1,"martin"),(2,"martin"),(3,"tom"),(4,"marry"),(5,"jacky"),(6,"[root@ansible ~]# mysqldump -uroot -p123456 xxx >