記一次MySQL無法啟動(dòng)及修復(fù)經(jīng)歷

記得有次本地的MySQL無法啟動(dòng),網(wǎng)上說,去刪掉InnoDB日志就行,我就傻乎乎的去刪掉了InnoDB相關(guān)的文件,果然,沒有任何問題,正常啟動(dòng)了。

可是誰曾想,過了幾天,故障復(fù)現(xiàn)了,我就按部就班的又去刪除,結(jié)果,又解決了。

可是,現(xiàn)在棘手的問題又出現(xiàn)了,數(shù)據(jù)庫,徹底的掛掉了。

[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

按照網(wǎng)上的說法,沒救了,因?yàn)榈谝淮蝿h除了InnoDB的ibdata1文件,這個(gè)文件是共享表空間,是不可以隨便亂刪的。

可是想著我的數(shù)據(jù)庫里還存著很多東西,不能就這樣放棄。

終于,找到了強(qiáng)力解決方法!

修復(fù)方法,打開my.cnf文件,把開啟mysql的innodb強(qiáng)制修復(fù)屬性

[mysqld]

innodb_force_recovery = 1

啟動(dòng)服務(wù)后,瞬間好了,數(shù)據(jù)完好無損,沒有丟失。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容