場景:兩台資料庫執行一段時間後發現集群掛了,一台服務正常,一台不正常。
日誌如下:
[error] innodb: attempted to open a previously opened tablespace. previous tablespace mysql/innodb_table_stats uses space id: 1 at filepath: ./mysql/innodb_table_stats.ibd. cannot open tablespace testdb/dr_actions which uses space id: 1 at filepath: ./testdb/dr_actions.ibd2013-11-18
21:25:25 a171e1a8 innodb: operating system error number 2
in a file
operation.
innodb: the error means the system cannot
find
the path specified.
innodb: if you are installing innodb, remember that you must create
innodb: directories yourself, innodb does not create them.
innodb: error: could not open single-table tablespace file ./testdb/dr_actions.ibd
innodb: we
donot continue the crash recovery, because the table may become
innodb: corrupt
the innodb log to it.
innodb: to fix the problem and start mysqld:
innodb:
1) if there is a permission problem in the file
and mysqld cannot
innodb: open the
file
, you should modify the permissions.
innodb:
2) if the table is not needed, or you can restore it from a backup,
innodb:
then you can remove the .ibd file, and innodb will do
a normal
innodb: crash recovery and ignore that table.
innodb:
3) if the file
system or the disk is broken, and you cannot remove
innodb: the .ibd
file, you can set innodb_force_recovery > 0
inmy.cnf
innodb: and force innodb to continue crash recovery here.
解決方法:
[mysqld]innodb_force_recovery=1
重啟資料庫服務
啟動成功後,在去掉該條記錄,再次重啟資料庫服務,即可。
可參看:
那是第一種情況,還有一種情況是兩端的資料不一致,導致無法啟動成功。
mysql無法啟動
本來是要在伺服器上執行程式,然後程式獲取的資料直接寫進伺服器,後來由於伺服器要麼訪問不了weibo.com要麼訪問不了weibo.cn,訪問速度各種慢,缺少各種外掛程式。本來程式三天寫好的,結果為了把程式移植到伺服器上花了10天左右的時間,最後因為伺服器的ip位址是在是差勁,好多網路都不能訪問,最後...
mysql無法啟動
今天在做mysql的主從複製時,準備在windows下的mysql的配置檔案裡新增log bin引數,但是新增之後發現,我無論如何重啟服務,在mysql命令列輸出show variables like log bin log一直顯示off狀態。然後我就開始懷疑我改的配置檔案不是資料庫啟動時參考的檔案...
無法啟動mysql
檢視.err檔案發現 usr local webserver mysql libexec mysqld table mysql.plugin doesn t exist 081118 0 48 44 error can t open the mysql.plugin table.please run...