MySQLでInnoDBが無効になる

データベースのサイズが限界まで近づいてきたのでmysqldumpで一度データを別の場所に移して、データ本体を削除した。

rm -f /var/lib/mysql/ibdata

削除後、mysqldumpでデータを元に戻した。

・・・が、mysqldが再起動できない。

色々調べてみるとinnoDBのログのサイズが問題だとか。
どうやらib_logfile0とかib_logfile1を削除する必要があるらしい。

rm -f /var/lib/mysql/ib_logfile*

これで再起動はできたがなぜかinnoDBが無効になっている。

mysql -uuser -ppassword mydb -e "show engines;"

Engine Support Comment
InnoDB DISABLED Supports trans...
ログにはこんなメッセージが・・・

090416 14:22:57 mysqld started
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html

さらに調査をするとibdata1っていうファイルも削除する必要があるとの事。

rm -f /var/lib/mysql/ib_data1

mysqldを再起動、確かめてみるInnoDBが有効になってました☆

mysql -uuser -ppassword mydb -e "show engines;"

Engine Support Comment
InnoDB YES Supports trans...

参照: http://www.dbafieldnotes.com/2008/12/troubleshooting-and-trimming-innodb_18.html