記得有次本地的MySQL無法啟動嘿悬,網上說,去刪掉InnoDB日志就行水泉,我就傻乎乎的去刪掉了InnoDB相關的文件善涨,果然,沒有任何問題草则,正常啟動了钢拧。
可是誰曾想,過了幾天炕横,故障復現了源内,我就按部就班的又去刪除,結果份殿,又解決了膜钓。
可是,現在棘手的問題又出現了卿嘲,數據庫颂斜,徹底的掛掉了。
[ERROR] InnoDB: Attempted to open a previously opened tablespace
2017-08-18 20:07:04 140736493900736 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace blockvotes/vote uses space ID: 7 at filepath: ./blockvotes/vote.ibd. Cannot open tablespace phpmyadmin/pma__pdf_pages which uses space ID: 7 at filepath: ./phpmyadmin/pma__pdf_pages.ibd
2017-08-18 20:07:04 7fffc4b9d3c0 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 ./phpmyadmin/pma__pdf_pages.ibd
按照網上的說法拾枣,沒救了沃疮,因為第一次刪除了InnoDB的ibdata1文件,這個文件是共享表空間梅肤,是不可以隨便亂刪的司蔬。
可是想著我的數據庫里還存著很多東西,不能就這樣放棄姨蝴。
終于俊啼,找到了強力解決方法!
修復方法似扔,打開my.cnf文件吨些,把開啟mysql的innodb強制修復屬性
[mysqld]
innodb_force_recovery = 1
啟動服務后搓谆,瞬間好了,數據完好無損豪墅,沒有丟失泉手。