Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

1 Answer

up vote 5 down vote accepted

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 !!!

share|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
    
Thanks you very much! –  plcstpierre Oct 14 '11 at 13:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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