So I have that complex MySQL dump as a backup. Unfortunately, that backup is complex and we use evil triggers.

Some of our evil triggers had a comment lines starting with the # character.

When I backup the database, the resulting dump save the # lines. The problem is when I am doing the restore. The line starting with # are replaced by empty lines.

So I am looking for a way to restore the dump WITH the lines starting with the pound.

  • Could you provide additional information? What is the version of MySQL Server? What method you use for restoring - is it via mysql command line client, through external program like DBVisualizer, or some other way? And how did you originally crate the triggers with the "#" comment lines, what tool or client was used? – dabest1 Oct 14 '11 at 1:18

OMG I know your problem !!!

Here is the problem: The mysql client filters out comments.

-c, --comments      Preserve comments. Send comments to the server. The
                    default is --skip-comments (discard comments), enable
                    with --comments.

Just load the mysqldump file like this:

mysql -u... -p... --comments < dumpfile.sql

Give it a Try !!!

| improve this answer | |
  • deleting my response; yours seems more legit – atxdba Oct 14 '11 at 2:59
  • Deleting my answer as well. Looks like --comments option is introduced starting from MySQL 5.0.52 and MySQL 5.1.23. – dabest1 Oct 14 '11 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.