I’ve found a bug in ‘–innodb-optimize-keys’, which causes dumps not to be able to be restored.
This is related to the FK constraints, whom FOREGIN_KEY_CHECKS=0 does not cause to be ignored under certain circumstances:
SET FOREIGN_KEY_CHECKS = 0;
# Doesn't fail, as expected
# CREATE TABLE a( val INT, FOREIGN KEY testfk ( val ) REFERENCES b( val ) );
# Fails, unexpectedly (on the first statement)
# CREATE TABLE b( val INT );
ALTER TABLE b ADD INDEX( val );
This is the typical structure of a dump created with --innodb-optimize-keys.