Interesting

- 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?
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.
July 27, 2008 at 8:12 pm
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.
July 29, 2008 at 5:22 pm