-r, --result-file=name 輸出檔案
mysqldump --default-character-set=utf8 -r mysql.sql -h localhost -u root -p yourdb
-t, --no-create-info Don't write table creation info.
mysqldump -uroot -p -t -d database
-c, --complete-insert Use complete insert statements.
$ mysqldump -hlocalhost -uroot -t neo test INSERT INTO `test` VALUES (98,'neo','chen'),(112,'jam','zheng'),(113,'john','meng'); $ mysqldump -hlocalhost -uroot -c -t neo test INSERT INTO `test` (`userid`, `username`, `password`) VALUES (98,'neo','chen'),(112,'jam','zheng'),(113,'john','meng');
--extended-insert 預設開啟
INSERT INTO `test` VALUES (98,'neo','chen'),(112,'jam','zheng'),(113,'john','meng');
每條記錄使用一次insert
$ mysqldump -hlocalhost -uroot --skip-extended-insert -t neo test |more INSERT INTO `test` VALUES (98,'neo','chen'); INSERT INTO `test` VALUES (111,'neo','chen'); INSERT INTO `test` VALUES (112,'jam','zheng'); INSERT INTO `test` VALUES (113,'john','meng');
該參數mysqldump輸出中包含下面
預設情況
LOCK TABLES `tbl_name` WRITE;
如果使用這個參數就不會輸出 LOCK TABLE
--comments附加註釋信息,預設為打開。可以用--skip-comments取消
-- -- Table structure for table `demo` -- DROP TABLE IF EXISTS `demo`; ... ... -- Dump completed on 2014-02-13 13:31:05
使用 --skip-comments後
DROP TABLE IF EXISTS `demo`; ... ...
--compact
mysqldump --default-character-set=utf8 -h localhost -u root -p -t yourdb yourtable --skip-extended-insert --compact
運行後導出純淨的 INSERT 語句