Thursday, December 10, 2009

It turns out you can farkle the data dictionary in mysql by renaming a dB to something like db-OLD. You get an error like this:

091210 10:49:30 InnoDB: Error: table `crowd/hibernate_unique_key` already exists in InnoDB internal
InnoDB: data dictionary. Have you deleted the .frm file
InnoDB: and not used DROP TABLE? Have you used DROP DATABASE
InnoDB: for InnoDB tables in MySQL version <= 3.23.43?
InnoDB: See the Restrictions section of the InnoDB manual.
InnoDB: You can drop the orphaned table inside InnoDB by
InnoDB: creating an InnoDB table with the same name in another
InnoDB: database and copying the .frm file to the current database.
InnoDB: Then MySQL thinks the table exists, and DROP TABLE will
InnoDB: succeed.
InnoDB: You can look for further help from
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/innodb-troubleshooting.html

"/var/log/mysqld.log" [Modified] 10449 lines --100%--

The fix is to remove the backup database.

BTW: If you name something blah -OLD in mysql, the mysql client can't deal with "-OLD" or at least I don't know how to quote / escape it. Didn't try \-OLD but that might have worked. I used mysqladmin drop blah-OLD.

No comments: