這篇文章主要講解了“MySQL innodb異常如何處理”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“mysql innodb異常如何處理”吧!
網(wǎng)站的建設(shè)成都創(chuàng)新互聯(lián)公司專注網(wǎng)站定制,經(jīng)驗(yàn)豐富,不做模板,主營網(wǎng)站定制開發(fā).小程序定制開發(fā),H5頁面制作!給你煥然一新的設(shè)計(jì)體驗(yàn)!已為成都石雕等企業(yè)提供專業(yè)服務(wù)。
為避免再從其他地方導(dǎo)入這個(gè)數(shù)據(jù)的麻煩,先對當(dāng)前庫的數(shù)據(jù)庫文件做了個(gè)備份(/var/lib/mysql/位置)。接下來將Percona server 5.7包進(jìn)行了卸載,重新安裝原先老的5.1.71的包,啟動mysql服務(wù),提示Unknown/unsupported table type: innodb,無法正常啟動。
110509 12:04:27 InnoDB: Initializing buffer pool, size = 384.0M 110509 12:04:27 InnoDB: Completed initialization of buffer pool InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes InnoDB: than specified in the .cnf file 0 157286400 bytes! 110509 12:04:27 [ERROR] Plugin 'InnoDB' init function returned error. 110509 12:04:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 110509 12:04:27 [ERROR] Unknown/unsupported table type: innodb 110509 12:04:27 [ERROR] Aborting 110509 12:04:27 [Note] /usr/sbin/mysqld: Shutdown complete
刪除/var/lib/mysql/目錄,重新啟動數(shù)據(jù)庫服務(wù),并初始化,發(fā)現(xiàn)正常,show engines能發(fā)現(xiàn)有innodb引擎。再將數(shù)據(jù)庫停掉,將之前備份的/var/lib/mysql/目錄的內(nèi)容覆蓋當(dāng)前位置的內(nèi)容,重啟。又發(fā)現(xiàn)不能進(jìn)行啟動,報(bào)錯(cuò)內(nèi)容和剛剛一樣。
/var/lib/mysql目錄內(nèi)容的結(jié)構(gòu)如下:
-rw-rw---- 1 mysql mysql 10485760 2月 26 18:10 ibdata1 -rw-rw---- 1 mysql mysql 5242880 2月 26 18:10 ib_logfile0 -rw-rw---- 1 mysql mysql 5242880 2月 26 17:20 ib_logfile1 drwx------ 2 mysql mysql 4096 2月 26 17:20 mysql drwx------ 2 mysql mysql 4096 2月 26 17:24 wiki
wiki目錄是測試數(shù)據(jù)的庫,ibdata1文件為數(shù)據(jù)文件,ib開頭的兩個(gè)文件為日志文件,mysql 目錄下為系統(tǒng)庫相關(guān)的東西 。再次使用初始化的數(shù)據(jù),并將wiki目錄和ibdata1文件覆蓋到/var/lib/mysql 目錄下,可以正常啟動,也可以正常登錄。
不過在通過mysqldump備份時(shí),又提示unknow table engine “Innodb” 。登錄后,查看當(dāng)前所有的引擎類型,發(fā)現(xiàn)其中果然不存在innodb類型:
通過alter命令修改其中一個(gè)表的類型為MyISAM ,發(fā)現(xiàn)仍然報(bào)錯(cuò)。
通過 find 查找發(fā)現(xiàn)/usr/lib64/mysql/plugin/目錄下有ha_innodb_plugin.so文件。印象中mysql5以后的版本支持在線插件安裝 。通過下面查看確認(rèn),果然支持:
使用如下命令加載時(shí),發(fā)現(xiàn)不成功:
install plugin innodb soname 'ha_innodb.so';
在/etc/my.cnf中增加如下配置:
plugin-load=innodb=ha_innodb_plugin.so plugin_dir=/usr/lib64/mysql/plugin/ default-storage-engine=InnoDB
發(fā)現(xiàn)仍啟動失敗。查看mysql-error.log發(fā)現(xiàn)有如下內(nèi)容:
InnoDB: Database page corruption on disk or a failed InnoDB: file read of page 7. InnoDB: You may have to recover from a backup. InnoDB: It is also possible that your operating InnoDB: system has corrupted its own file cache InnoDB: and rebooting your computer removes the InnoDB: error. InnoDB: If the corrupt page is an index page InnoDB: you can also try to fix the corruption InnoDB: by dumping, dropping, and reimporting InnoDB: the corrupt table. You can use CHECK InnoDB: TABLE to scan your table for corruption. InnoDB: See also http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
打開forcing-innodb-recovery官方頁面,發(fā)現(xiàn)可以通過指定innodb_force_recovery參數(shù),進(jìn)行強(qiáng)制啟動和恢復(fù)。在/etc/my.cnf中增加如下內(nèi)容:
innodb_force_recovery=6
重新啟動成功了。通過mysqldump備份也沒有問題,將備份數(shù)據(jù)導(dǎo)入其他主機(jī)發(fā)現(xiàn)也正??梢詼y試。
這下就好搞了,將mysql徹底刪除,重新安裝Percona server 5.7,安裝完后,建庫,還原數(shù)據(jù),程序重新連接,一切OK。
感謝各位的閱讀,以上就是“mysql innodb異常如何處理”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對mysql innodb異常如何處理這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!
網(wǎng)站標(biāo)題:mysqlinnodb異常如何處理
標(biāo)題網(wǎng)址:http://m.rwnh.cn/article16/jejsdg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)頁設(shè)計(jì)公司、網(wǎng)站設(shè)計(jì)、動態(tài)網(wǎng)站、網(wǎng)站收錄、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)