首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 數據庫知識 >  >> MySQL 資料庫 >> MySQL 綜合教學

MySQL 僅支持 MyISAM 如何啟用 InnoDB?配置向導遷移實戰與錯誤日誌分析

     編輯:MySQL 綜合教學

故障現象

安裝 MySQL 選擇「Non-Transactional Database Only」(僅 MyISAM),導入 WordPress 數據庫(InnoDB 表)後,訪問 phpMyAdmin 觸發 mysqld-nt.exe 內存讀取錯誤,服務崩潰。

嘗試修復:配置向導切換引擎

  1. 重新運行 MySQLInstanceConfig.exe
  2. Database Usage 選 Multifunctional Database(支持 InnoDB)
  3. InnoDB Tablespace Settings 指定 ibdata1 路徑
  4. Execute 卡在 Start Service,報錯 Error 1067: 進程意外中止

錯誤日誌深度分析


InnoDB: Error: log file .\ib_logfile0 is of different size 0 52428800 bytes
InnoDB: than specified in the .cnf file 0 10485760 bytes!
[ERROR] Default storage engine (InnoDB) is not available
[ERROR] Aborting

核心提示:現有 ib_logfile* 大小與配置不匹配。

分步修復實戰

  1. 刪除舊日誌文件
    
    del data\ib_logfile0
    del data\ib_logfile1
    
  2. 重啟系統(關鍵)

    僅重啟服務不生效,必須重啟操作系統釋放文件鎖定。

  3. 仍報錯?繼續看日誌
    
    InnoDB: Cannot initialize created log files because
    InnoDB: data files are corrupt, or new data files were
    InnoDB: created when the database was started previous
    InnoDB: time but the database was not shut down normally
    
  4. 徹底清理核心文件
    
    del data\ibdata1
    del data\ib_logfile*
    
  5. 再次重啟系統,服務正常啟動
    
    InnoDB: The first specified data file ...\ibdata1 did not exist: new database to be created!
    InnoDB: Setting file ...\ibdata1 size to 10 MB
    InnoDB: Log file .\ib_logfile0 did not exist: new to be created
    ...
    InnoDB: Started; log sequence number 0 0
    [Note] ready for connections.
    

總結經驗

  • 引擎切換本質是重新初始化 InnoDB 核心文件
  • 必須刪除舊 ibdata1、ib_logfile* 後重啟系統
  • 錯誤日誌 .err 是診斷核心,逐行分析 LSN、文件大小不匹配信息
  • 生產環境嚴禁直接切換引擎,應遷移數據至新實例
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved