How can I get rid of these comments in a MySQL dump?
WHOA! These aren't really comments even though they look that way. They are conditional-execution tokens.
Take this line:
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
If the version of mySQL is 4.00.14 or higher, then the MySQL server will run this statement.
This magic comment syntax is documented in the Comment Syntax section of the manual.
You probably don't want to get rid of this stuff.
I know this is an ancient question, but here is an answer at least. I also couldn't find a flag in mysqldump to remove the conditional comments, or indeed a better option to set a minimum mysql version for these comments to appear. If you just want to nuke them all, you can do so using grep or sed (sed leaves blank lines, grep does not):
mysqldump ... | grep -v '^\/\*![0-9]\{5\}.*\/;$'
mysqldump ... | sed -e 's/^\/\*![0-9]\{5\}.*\/;$//g'
To answer my own wish of conditionally removing comments dependent on mysql version, use one of these (removes any comments for anything < mysql5):
mysqldump ... | grep -v '^\/\*![0-4][0-9]\{4\}.*\/;$'
mysqldump ... | sed -e 's/^\/\*![0-4][0-9]\{4\}.*\/;$//g'
Try --skip-comments
?
Thanks
Edit:
I see .. Try this
--skip-add-drop-table --skip-add-locks --skip-disable-keys --skip-set-charset
Play around to remove some of the options till you get the desired result, basically this is same as --compact
without --skip-comments
--skip-comments
removes the comments relating to version and stuff ..
Have you tried the shortcut option --compact
?
Information here.