五月综合激情婷婷六月,日韩欧美国产一区不卡,他扒开我内裤强吻我下面视频 ,无套内射无矿码免费看黄,天天躁,日日躁,狠狠躁

新聞動態(tài)

mysql innodb 異常修復(fù)經(jīng)驗(yàn)分享

發(fā)布日期:2022-04-15 11:53 | 文章來源:CSDN

一套測試用的mysql庫,之前用的centos6默認(rèn)源里的mysql 5.1.71的版本 。后來想試用下Percona server 5.7,由于這套庫里沒有什么重要數(shù)據(jù) 。所以操作前也未進(jìn)行備份,配置好源后,直接就進(jìn)行了安裝。數(shù)據(jù)文件也存放在默認(rèn)位置,安裝完成后,直接啟動mysql,發(fā)現(xiàn)啟動失敗,發(fā)現(xiàn)無法啟動正常啟動。

一、回退重新裝mysql

為避免再從其他地方導(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 目錄下,可以正常啟動,也可以正常登錄。

二、innodb模塊重裝

不過在通過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。

總結(jié):

由于mysql innodb數(shù)據(jù)文件的特性,可以在出現(xiàn)問題,無法正常啟動時(shí),先將./ib_logfile0 和 ./ib_logfile1 兩個(gè)日志文件先移走,再啟動,如果還不成功,可以用innodb_force_recovery參數(shù)進(jìn)行強(qiáng)制恢復(fù)。除此之外,日志也很重啟,有問題先看日志。

海外穩(wěn)定服務(wù)器

版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

實(shí)時(shí)開通

自選配置、實(shí)時(shí)開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部