メモの日々


2005年11月09日(水) [長年日記]

  • 昨日早く寝たので今日は早めに起きられた。が、昼間やたら眠い。

[db] mysqldumpした結果のリストア時にエラー

ERROR 1005 at line 11: Can't create table './nantoka/kantoka.frm' (errno: 150)

というエラーになった。

IT革命〜などに説明があるが、外部キーを使用している場合にこのエラーが出る。対策は、mysqldumpの結果ファイルの先頭に「SET FOREIGN_KEY_CHECKS=0;」を付与すること。

また、mysqldumpのマニュアルのUser Comments欄に

After adding "SET FOREIGN_KEY_CHECKS=0;" remember to append the "SET FOREIGN_KEY_CHECKS=1;" at the end of the import file. The potential problem is that any data inconsistency that would've made the foreign key failed during import would have made it into the database even after the forieng keys are turned back on. This is especially true if the foreign keys aren't turned back on after a long period of time which can happen if the "SET FOREIGN_KEY_CHECKS=1;" was not appended to the import file in the first place.

とあり、ファイルの最後に「SET FOREIGN_KEY_CHECKS=1;」というのも付与した方がよさそう。

やること

  • 蛍光灯を捨てる
  • 宛名シール
  • 収入印紙