我的情況是 我在優化mysql的時候修改了關于Innodb參數的數值,造成前後不一緻,進而導緻Innodb資料的表無法支援,
而 show engines;的時候,也沒有Innodb存儲引擎.
幸虧修改的時候有備份,恢複備份,重新開機mysql,恢複正常。
錯誤日志:
InnoDB: Error: log file /data/database/ib_logfile0 is of different size 0 134217728 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
121226 12:05:39 [ERROR] Plugin 'InnoDB' init function returned error.
121226 12:05:39 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
121226 12:05:39 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode.
121226 12:05:39 [Warning] 'user' entry '@school-my.chinaedu.com' ignored in --skip-name-resolve mode.
121226 12:05:39 [Note] Event Scheduler: Loaded 0 events
121226 12:05:39 [Note] /home/101/mysql/libexec/mysqld: ready for connections.
Version: '5.1.46-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution
------------------------------------
今天對MySQL資料庫進行了實體拷貝,遇到一個棘手的問題,MySQL能正常啟動,不過打開資料表的時候,提示Unknow Table Engine InnoDB.
錯誤提示很明顯是沒有加載InnoDB。在網上找了一下,基本上有兩種方法:
1:注釋掉skip-innodb選項
2:删掉兩個 ib_logfile* 檔案
不過這兩個方法都沒用。我檢視了MySQL的錯誤日志,發現有以下提示:
InnoDB: Error: log file ./ib_logfile0 is of different size 0 25165824 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
原來我拷貝過去的log檔案最大是24MB,而MySQL預設的配置是5MB,這兩個數值不統一,導緻了InnoDB啟動時出現了錯誤。
解決方法:修改MySQL的配置: innodb_log_file_size = 24M 。其中24M對應的就是你的logfile的大小。
----------------------------------------------
最近在看MYSQL優化的參數,改了innodb_log_file_size參後,啟動下面報錯,然來是改了這個參數後需要關閉MYSQLSQL删除ib_logfile0, ib_logfile1這些檔案,再啟動MYSQL。
080622 10:53:27 mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended
080622 10:53:27 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
InnoDB: Error: log file /usr/local/mysql/data/ib_logfile0 is of different size 0 104857600 bytes
InnoDB: than specified in the .cnf file 0 134217728 bytes!
080622 10:53:28 [ERROR] Plugin 'InnoDB' init function returned error.
080622 10:53:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
080622 10:53:28 [Note] Event Scheduler: Loaded 0 events
080622 10:53:28 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.1.24-rc-log' socket: '/usr/local/mysql/tmp/mysql.sock' port: 3307 Source distribution
080622 10:53:28 [Note] Event Scheduler: scheduler thread started with id 1
080622 11:20:07 [Note] /usr/local/mysql/libexec/mysqld: Normal shutdown
今天有點忙,經過1個多星期的壓力測試後,得到了很多資料,着手根據資料進行資料庫伺服器的優化!最累就是這個東西了- -
優化方案在完成後我貼出來慢慢說,現在先記錄下今天碰到的第一個問題………
優化INNODB引擎的參數的時候,為了進一步提高效率,又一次提高了innodb_buffer_pool_size的值(768M,伺服器很爛,記憶體就1G,預訂的伺服器還沒到,估計到時候又要測一次,又要累了,是以老總的要求就是在這種爛伺服器上測個大概,比較好定位将來要買什麼價位的伺服器………)
innodb_buffer_pool_size=768M
innodb_log_file_size=256M
innodb_log_buffer_size=8M
innodb_additional_mem_pool_size=4M
innodb_flush_log_at_trx_commit=0
innodb_thread_concurrency=20
以上是對innodb引擎的初步優化,我們是一次性更換了所有的參數,然後儲存配置檔案,然後無法啟動mysql,最後一步一步來發現是更新innodb_log_file_size=256M時候出現了問題,隻要加上這個就無法啟動(第一次沒經驗啊- -汗了)。
後來才知道原來要STOP服務先,然後再删除原來的檔案………
打開/var/lib/mysql
删除ib_logfile0, ib_logfile1........ib_logfilen
再開啟選項,成功啟動。