最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2017年04月30日 15:30:00   投稿:mdxy-dxy  
這篇文章主要介紹了mysql innodb 異常修復(fù)經(jīng)驗分享,需要的朋友可以參考下

一套測試用的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)入這個數(shù)據(jù)的麻煩,先對當(dāng)前庫的數(shù)據(jù)庫文件做了個備份(/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)行啟動,報錯內(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開頭的兩個文件為日志文件,mysql 目錄下為系統(tǒng)庫相關(guān)的東西 。再次使用初始化的數(shù)據(jù),并將wiki目錄和ibdata1文件覆蓋到/var/lib/mysql 目錄下,可以正常啟動,也可以正常登錄。

二、innodb模塊重裝

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

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

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

使用如下命令加載時,發(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)問題,無法正常啟動時,先將./ib_logfile0 和 ./ib_logfile1 兩個日志文件先移走,再啟動,如果還不成功,可以用innodb_force_recovery參數(shù)進(jìn)行強(qiáng)制恢復(fù)。除此之外,日志也很重啟,有問題先看日志。

相關(guān)文章

最新評論

南漳县| 色达县| 南乐县| 清徐县| 临邑县| 淅川县| 商南县| 鄂托克旗| 平邑县| 新竹市| 巴林右旗| 卫辉市| 阿城市| 仲巴县| 报价| 会东县| 潜江市| 新野县| 文水县| 镇沅| 本溪市| 托里县| 雷州市| 巴马| 太仆寺旗| 嘉峪关市| 雷波县| 南部县| 福海县| 铜川市| 安远县| 永泰县| 射洪县| 池州市| 唐山市| 丘北县| 乃东县| 临朐县| 拉孜县| 安远县| 绥宁县|