Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 7/24/2008


mysqldump and load

  • There was war story told involving software that’s not generally available. However, one tidbit that may be of general interest is a reminder that you don’t necessarily get a perfect copy of your mysql database when restoring from a dump of that database. Mysqldump by default writes the data of each table preceded by a DROP TABLE IF EXISTS and a CREATE TABLE statement. This covers you in most situations, but misses when new tables have been created since the dump was made — those new tables are not deleted. They may not cause problems, but some systems are sensitive to the existence of those tables, such as rails and the schema_info and schema_migrations tables.

Ask for Help

  • question: Is merb hosting different from rails hosting?
    • answer: no

  1. garry says:

    you just need to add –add-drop-database to your dump command to avoid what you describe. I do this in all my backup scripts.

  2. Nathan Wilmes says:

    We’ve done this now. One key thing about mysqldump – you need to provide a –databases option rather than a single database option. Otherwise, the –add-drop-database option is ignored… MySQL decides that since you’re dumping a single database, you couldn’t possibly want to drop and recreate it.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *