ERROR 1016: Can't open file: 'db1.table1'. (errno: 1)
--err-log内容
051110 11:17:09 InnoDB: Started; log sequence number 0 43645 /usr/sbin/mysqld: ready for connections. Version: '4.1.14-standard' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Edition - Standard (GPL) 051110 11:17:39 InnoDB: Error: table `db1/table1` does not exist in the InnoDB internal InnoDB: data dictionary though MySQL is trying to drop it. InnoDB: Have you copied the .frm file of the table to the InnoDB: MySQL database directory from another database? InnoDB: You can look for further help from InnoDB: http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html
[エラー原因]
MySQLを起動しようとしたら、サイズが違うぞエラーがInnoDBテーブルに対して出力されていた。
データを入れていないテーブルだったのでデータベースごと削除して、MySQLを再起動した。
再起動後、"DROP TABLE db1.table1;"をしたら、上記のエラー文言が出力された。
InnoDBテーブルをDROPせずにデータファイルを削除したために、アクセスできずエラーといわれている状態。
[対処]
- /etc/mysql.cnf に innodb_force_recovery = 1 を設定して再起動
- 再起動できなかった
- /etc/mysql.cnf に innodb_force_recovery = 2 を設定して再起動
- 再起動できた
- 問題のテーブルは見えないが、データベースは見える。
- DROP DATABASE db1;
- ファイルがあるからdb1ディレクトリは削除できない。というエラー(メッセージをメモし忘れた)
- cd データディレクトリ/db1
- rm -rf ./*
- DROP DATABASE db1;
- OK!
- #innodb_force_recovery = 2
- MySQL再起動
- CREATE DATABASE db1;
- OK!
[備考]
エラーログに参考URLが載っているが、MySQL全機能リファレンスのinnoDBクラッシュリカバリを参考にした