mysqlinnodb異常如何處理

這篇文章主要講解了“MySQL innodb異常如何處理”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“mysql innodb異常如何處理”吧!

網(wǎng)站的建設(shè)成都創(chuàng)新互聯(lián)公司專注網(wǎng)站定制,經(jīng)驗(yàn)豐富,不做模板,主營(yíng)網(wǎng)站定制開(kāi)發(fā).小程序定制開(kāi)發(fā),H5頁(yè)面制作!給你煥然一新的設(shè)計(jì)體驗(yàn)!已為成都石雕等企業(yè)提供專業(yè)服務(wù)。

一、回退重新裝mysql

為避免再?gòu)钠渌胤綄?dǎo)入這個(gè)數(shù)據(jù)的麻煩,先對(duì)當(dāng)前庫(kù)的數(shù)據(jù)庫(kù)文件做了個(gè)備份(/var/lib/mysql/位置)。接下來(lái)將Percona server 5.7包進(jìn)行了卸載,重新安裝原先老的5.1.71的包,啟動(dòng)mysql服務(wù),提示Unknown/unsupported table type: innodb,無(wú)法正常啟動(dòng)。

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/目錄,重新啟動(dòng)數(shù)據(jù)庫(kù)服務(wù),并初始化,發(fā)現(xiàn)正常,show engines能發(fā)現(xiàn)有innodb引擎。再將數(shù)據(jù)庫(kù)停掉,將之前備份的/var/lib/mysql/目錄的內(nèi)容覆蓋當(dāng)前位置的內(nèi)容,重啟。又發(fā)現(xiàn)不能進(jìn)行啟動(dòng),報(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目錄是測(cè)試數(shù)據(jù)的庫(kù),ibdata1文件為數(shù)據(jù)文件,ib開(kāi)頭的兩個(gè)文件為日志文件,mysql 目錄下為系統(tǒng)庫(kù)相關(guān)的東西 。再次使用初始化的數(shù)據(jù),并將wiki目錄和ibdata1文件覆蓋到/var/lib/mysql 目錄下,可以正常啟動(dòng),也可以正常登錄。

二、innodb模塊重裝

不過(guò)在通過(guò)mysqldump備份時(shí),又提示unknow table engine “Innodb” 。登錄后,查看當(dāng)前所有的引擎類型,發(fā)現(xiàn)其中果然不存在innodb類型:

mysql innodb異常如何處理

通過(guò)alter命令修改其中一個(gè)表的類型為MyISAM ,發(fā)現(xiàn)仍然報(bào)錯(cuò)。

mysql innodb異常如何處理

通過(guò) find 查找發(fā)現(xiàn)/usr/lib64/mysql/plugin/目錄下有ha_innodb_plugin.so文件。印象中mysql5以后的版本支持在線插件安裝 。通過(guò)下面查看確認(rèn),果然支持:

mysql innodb異常如何處理

使用如下命令加載時(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)仍啟動(dòng)失敗。查看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

打開(kāi)forcing-innodb-recovery官方頁(yè)面,發(fā)現(xiàn)可以通過(guò)指定innodb_force_recovery參數(shù),進(jìn)行強(qiáng)制啟動(dòng)和恢復(fù)。在/etc/my.cnf中增加如下內(nèi)容:

innodb_force_recovery=6

重新啟動(dòng)成功了。通過(guò)mysqldump備份也沒(méi)有問(wèn)題,將備份數(shù)據(jù)導(dǎo)入其他主機(jī)發(fā)現(xiàn)也正??梢詼y(cè)試。

這下就好搞了,將mysql徹底刪除,重新安裝Percona server 5.7,安裝完后,建庫(kù),還原數(shù)據(jù),程序重新連接,一切OK。

感謝各位的閱讀,以上就是“mysql innodb異常如何處理”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)mysql innodb異常如何處理這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

網(wǎng)站標(biāo)題:mysqlinnodb異常如何處理
標(biāo)題網(wǎng)址:http://muchs.cn/article16/jejsdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站設(shè)計(jì)、動(dòng)態(tài)網(wǎng)站網(wǎng)站收錄、標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)