欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MySQL數(shù)據(jù)庫innodb啟動失敗無法重啟的解決方法

 更新時(shí)間:2016年09月17日 16:10:57   投稿:daisy  
這篇文章給大家分享了MySQL數(shù)據(jù)庫innodb啟動失敗無法重啟的解決方法,通過總結(jié)自己遇到的問題分享給大家,讓遇到同樣問題的朋友們可以盡快解決,下面來一起看看吧。

問題介紹

電腦在使用過程中死機(jī),重啟后發(fā)現(xiàn)mysql沒有啟動成功,查看錯(cuò)誤日志發(fā)現(xiàn)是innodb出現(xiàn)問題導(dǎo)致mysql啟動失敗。

錯(cuò)誤日志

$ mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/fdipzonedeMacBook-Air.local.pid).

22:08:37 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2016-04-23 22:08:38 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-23 22:08:38 0 [Note] /usr/local/Cellar/mysql/5.6.24/bin/mysqld (mysqld 5.6.24) starting as process 3604 ...
2016-04-23 22:08:38 3604 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2016-04-23 22:08:38 3604 [Note] Plugin 'FEDERATED' is disabled.
2016-04-23 22:08:38 3604 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-04-23 22:08:38 3604 [Note] InnoDB: The InnoDB memory heap is disabled
2016-04-23 22:08:38 3604 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-04-23 22:08:38 3604 [Note] InnoDB: Memory barrier is not used
2016-04-23 22:08:38 3604 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-04-23 22:08:38 3604 [Note] InnoDB: Using CPU crc32 instructions
2016-04-23 22:08:38 3604 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-04-23 22:08:38 3604 [Note] InnoDB: Completed initialization of buffer pool
2016-04-23 22:08:38 3604 [Note] InnoDB: Highest supported file format is Barracuda.
2016-04-23 22:08:38 3604 [Note] InnoDB: Log scan progressed past the checkpoint lsn 68929933440
2016-04-23 22:08:38 3604 [Note] InnoDB: Database was not shutdown normally!
2016-04-23 22:08:38 3604 [Note] InnoDB: Starting crash recovery.
2016-04-23 22:08:38 3604 [Note] InnoDB: Reading tablespace information from the .ibd files...
2016-04-23 22:08:38 3604 [ERROR] InnoDB: checksum mismatch in tablespace ./test_user/user_recommend_code#P#pmax.ibd (table test_user/user_recommend_code#P#pmax)
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size:1024 Pages to analyze:64
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size: 1024, Possible space_id count:0
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size:2048 Pages to analyze:48
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size: 2048, Possible space_id count:0
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size:4096 Pages to analyze:24
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size: 4096, Possible space_id count:0
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size:8192 Pages to analyze:12
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size: 8192, Possible space_id count:0
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size:16384 Pages to analyze:6
2016-04-23 22:08:38 3604 [Note] InnoDB: VALID: space:2947354 page_no:3 page_size:16384
2016-04-23 22:08:38 3604 [Note] InnoDB: Page size: 16384, Possible space_id count:1
2016-04-23 22:08:38 3604 [Note] InnoDB: space_id:2947354, Number of pages matched: 1/1 (16384)
2016-04-23 22:08:38 3604 [Note] InnoDB: Chosen space:2947354

2016-04-23 22:08:38 3604 [Note] InnoDB: Restoring page 0 of tablespace 2947354
2016-04-23 22:08:38 3604 [Warning] InnoDB: Doublewrite does not have page_no=0 of space: 2947354
2016-04-23 22:08:38 7fff79b9e300 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 ./test_user/user_recommend_code#P#pmax.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.

解決方法

1.如果數(shù)據(jù)不重要或已經(jīng)有備份,只需要恢復(fù)mysql啟動

進(jìn)入mysql目錄,一般是: /usr/local/var/mysql/

刪除ib_logfile*

刪除ibdata*

刪除所有數(shù)據(jù)庫物理目錄(例如數(shù)據(jù)庫為test_db,則執(zhí)行rm -rf test_db

重啟動mysql

重新建立數(shù)據(jù)庫或使用備份覆蓋

2.如果數(shù)據(jù)很重要且沒有備份

可以使用innodb_force_recovery參數(shù),使mysqld跳過恢復(fù)步驟,啟動mysqld,將數(shù)據(jù)導(dǎo)出然后重建數(shù)據(jù)庫。

innodb_force_recovery 可以設(shè)置為1-6,大的數(shù)字包含前面所有數(shù)字的影響

     1、(SRV_FORCE_IGNORE_CORRUPT):忽略檢查到的corrupt頁。

     2、(SRV_FORCE_NO_BACKGROUND):阻止主線程的運(yùn)行,如主線程需要執(zhí)行full purge操作,會導(dǎo)致crash。

     3、(SRV_FORCE_NO_TRX_UNDO):不執(zhí)行事務(wù)回滾操作。

     4、(SRV_FORCE_NO_IBUF_MERGE):不執(zhí)行插入緩沖的合并操作。

     5、(SRV_FORCE_NO_UNDO_LOG_SCAN):不查看重做日志,InnoDB存儲引擎會將未提交的事務(wù)視為已提交。

     6、(SRV_FORCE_NO_LOG_REDO):不執(zhí)行前滾的操作。

在my.cnf(windows是my.ini)中加入

innodb_force_recovery = 6 
innodb_purge_thread = 0

重啟mysql

這時(shí)只可以執(zhí)行select,create,drop操作,但不能執(zhí)行insert,update,delete操作

執(zhí)行邏輯導(dǎo)出,完成后將innodb_force_recovery=0,innodb_purge_threads=1,然后重建數(shù)據(jù)庫,最后把導(dǎo)出的數(shù)據(jù)重新導(dǎo)入

總結(jié)

以上就是這篇文章的全部內(nèi)容,希望能對大家學(xué)習(xí)或者使用mysql的時(shí)候有所幫助,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。

相關(guān)文章

  • MySQL中給定父行找到所有子行的解決方案

    MySQL中給定父行找到所有子行的解決方案

    這篇文章主要給大家介紹了關(guān)于MySQL中給定父行找到所有子行的解決方案,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • 在Mac系統(tǒng)上配置MySQL以及Squel Pro

    在Mac系統(tǒng)上配置MySQL以及Squel Pro

    給大家講述一下如何在MAC蘋果系統(tǒng)上配置MYSQL數(shù)據(jù)庫以及Squel Pro的方法。
    2017-11-11
  • 為什么MySQL查詢速度會慢

    為什么MySQL查詢速度會慢

    這篇文章主要介紹了為什么MySQL查詢速度會慢的相關(guān)資料,需要的朋友可以參考下
    2022-12-12
  • MySQL索引是啥?不懂就問

    MySQL索引是啥?不懂就問

    索引是幫助數(shù)據(jù)庫高效獲取數(shù)據(jù)的一種數(shù)據(jù)結(jié)構(gòu),是基于數(shù)據(jù)表創(chuàng)建的,它包含了一個(gè)表中某些列的值以及記錄對應(yīng)的地址,并且把這些值存在一個(gè)數(shù)據(jù)結(jié)構(gòu)中,常見的有使用哈希表、B+樹作為索引
    2021-07-07
  • MySQL Aborted connection告警日志的分析

    MySQL Aborted connection告警日志的分析

    這篇文章主要介紹了MySQL Aborted connection告警日志的分析,幫助大家更好的理解和學(xué)習(xí)MySQL,感興趣的朋友可以了解下
    2020-08-08
  • mysql慢查詢介紹及開啟技巧詳解

    mysql慢查詢介紹及開啟技巧詳解

    這篇文章主要為大家介紹了mysql慢查詢介紹及開啟技巧詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-05-05
  • 優(yōu)化MySQL Join算法的性能的操作方法

    優(yōu)化MySQL Join算法的性能的操作方法

    本文介紹了優(yōu)化MySQL JOIN算法性能的多種方法,包括索引優(yōu)化、表結(jié)構(gòu)設(shè)計(jì)、查詢語句優(yōu)化和系統(tǒng)配置調(diào)整,通過合理創(chuàng)建索引、優(yōu)化表結(jié)構(gòu)、選擇合適的驅(qū)動表以及調(diào)整相關(guān)系統(tǒng)參數(shù),可以有效提高JOIN操作的性能,感興趣的朋友一起看看吧
    2025-02-02
  • MySQL 數(shù)據(jù)備份與還原的示例代碼

    MySQL 數(shù)據(jù)備份與還原的示例代碼

    這篇文章主要介紹了MySQL 數(shù)據(jù)備份與還原的相關(guān)知識,本文通過示例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-09-09
  • MySQL索引優(yōu)化Explain詳解

    MySQL索引優(yōu)化Explain詳解

    這篇文章主要介紹了MySQL索引優(yōu)化Explain詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-07-07
  • MySql索引原理和SQL優(yōu)化方式

    MySql索引原理和SQL優(yōu)化方式

    索引是提升數(shù)據(jù)庫查詢效率的有序存儲結(jié)構(gòu),包括主鍵索引、唯一索引、普通索引等,約束則用于數(shù)據(jù)完整性,包含主鍵、唯一、外鍵等約束,B+樹是常用的索引結(jié)構(gòu),減少磁盤IO次數(shù),索引應(yīng)用場景包括where、groupby、orderby
    2024-09-09

最新評論