搜尋
首頁資料庫mysql教程MySQL中ib_logfile和ibdata1参数大小被修改后_MySQL

1. 环境说明

RHEL 6.4 x86_64 + MySQL 5.5.37和MySQL 5.6.19

blog地址:http://blog.csdn.net/hw_libo/article/details/39215723

2. 案例:redo log文件(ib_logfile)大小参数被修改:innodb_log_file_size

innodb_log_file_size = 256M -- 修改为200M

版本是5.5的,启动失败,会出现如下错误:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 268435456 bytes  ## 原来redo log的大小
InnoDB: than specified in the .cnf file 0 209715200 bytes!   ## redo log被修改的大小
140912  0:01:12 [ERROR] Plugin 'InnoDB' init function returned error.
140912  0:01:12 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140912  0:01:12 [ERROR] Unknown/unsupported storage engine: InnoDB
140912  0:01:12 [ERROR] Aborting
版本是5.6.16之后的,正常启动,会自动将原来的redo log删除,然后重新生成新的redo log(这个比较重要):
2014-09-11 21:57:05 1093 [Warning] InnoDB: Resizing redo log from 2*16384 to 2*12800 pages, LSN=71249171
2014-09-11 21:57:05 1093 [Warning] InnoDB: Starting to delete and rewrite log files.    ## 删除原redo log
2014-09-11 21:57:05 1093 [Note] InnoDB: Setting log file ./ib_logfile101 size to 200 MB
InnoDB: Progress in MB: 100 200
2014-09-11 21:57:06 1093 [Note] InnoDB: Setting log file ./ib_logfile1 size to 200 MB
InnoDB: Progress in MB: 100 200
2014-09-11 21:57:07 1093 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-09-11 21:57:07 1093 [Warning] InnoDB: New log files created, LSN=71249171   ## 新redo log重建完毕
原redo log大小:2*16384*8(page的大小为8k)/1024=256MB

新redo log大小:2*12800*8/1024=200MB

3. 案例:ibdata1文件大小参数被修改:innodb_data_file_path

(1)ibdata1从大改小

innodb_data_file_path = ibdata1:1G:autoextend -- 修改为:ibdata1:300M:autoextend

在版本是5.5和5.6中,启动正常,并且日志中没有任何异常。但是如果将autoextend去掉,就会报错,启动失败,如:[版本:5.5.37]

InnoDB: Error: data file ./ibdata1 is of a different size
InnoDB: 65536 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 19200 pages!
140911 23:51:53 InnoDB: Could not open or create data files.
140911 23:51:53 InnoDB: If you tried to add new data files, and it failed here,
140911 23:51:53 InnoDB: you should now edit innodb_data_file_path in my.cnf back
140911 23:51:53 InnoDB: to what it was, and remove the new ibdata files InnoDB created
140911 23:51:53 InnoDB: in this failed attempt. InnoDB only wrote those files full of
140911 23:51:53 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
140911 23:51:53 InnoDB: remove old data files which contain your precious data!
140911 23:51:53 [ERROR] Plugin 'InnoDB' init function returned error.
140911 23:51:53 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140911 23:51:53 [ERROR] Unknown/unsupported storage engine: InnoDB
140911 23:51:53 [ERROR] Aborting

原来的ibdata1大小为:65536*8*2/1024=1024M=1G
当前ibdata1被修改为:19200*8*2/1024=300M
(2)ibdata1值小改大

比如:

innodb_data_file_path = ibdata1:1G:autoextend -- 修改为:ibdata1:1200M:autoextend

那么会在启动时出现如下错误:

*****在5.5版本中:[版本:5.5.37]

InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 65536 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 76800 pages, max 0 (relevant if non-zero) pages!
140911 23:57:43 InnoDB: Could not open or create data files.
140911 23:57:43 InnoDB: If you tried to add new data files, and it failed here,
140911 23:57:43 InnoDB: you should now edit innodb_data_file_path in my.cnf back
140911 23:57:43 InnoDB: to what it was, and remove the new ibdata files InnoDB created
140911 23:57:43 InnoDB: in this failed attempt. InnoDB only wrote those files full of
140911 23:57:43 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
140911 23:57:43 InnoDB: remove old data files which contain your precious data!
140911 23:57:43 [ERROR] Plugin 'InnoDB' init function returned error.
140911 23:57:43 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140911 23:57:43 [ERROR] Unknown/unsupported storage engine: InnoDB
140911 23:57:43 [ERROR] Aborting
*****在5.6版本中:[版本:5.6.19]
2014-09-11 22:20:01 1222 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 65536 pages (rounded down to MB) than
 specified in the .cnf file: initial 76800 pages, max 0 (relevant if non-zero) pages!
2014-09-11 22:20:01 1222 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the syste
m tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata fil
es InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be caref
ul: do not remove old data files which contain your precious data!
2014-09-11 22:20:01 1222 [ERROR] Plugin 'InnoDB' init function returned error.
2014-09-11 22:20:01 1222 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2014-09-11 22:20:01 1222 [ERROR] Unknown/unsupported storage engine: InnoDB
2014-09-11 22:20:01 1222 [ERROR] Aborting
原来的ibdata1大小为:65536*8*2/1024=1024M=1G

当前ibdata1被修改为:76800*8*2/1024=1200M

blog地址:http://blog.csdn.net/hw_libo/article/details/39215723

-- Bosco QQ:375612082

---- END ----
-------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
將用戶添加到MySQL:完整的教程將用戶添加到MySQL:完整的教程May 12, 2025 am 12:14 AM

掌握添加MySQL用戶的方法對於數據庫管理員和開發者至關重要,因為它確保數據庫的安全性和訪問控制。 1)使用CREATEUSER命令創建新用戶,2)通過GRANT命令分配權限,3)使用FLUSHPRIVILEGES確保權限生效,4)定期審計和清理用戶賬戶以維護性能和安全。

掌握mySQL字符串數據類型:varchar vs.文本與char掌握mySQL字符串數據類型:varchar vs.文本與charMay 12, 2025 am 12:12 AM

chosecharforfixed-lengthdata,varcharforvariable-lengthdata,andtextforlargetextfield.1)chariseffity forconsistent-lengthdatalikecodes.2)varcharsuitsvariable-lengthdatalikenames,ballancingflexibilitibility andperformance.3)

MySQL:字符串數據類型和索引:最佳實踐MySQL:字符串數據類型和索引:最佳實踐May 12, 2025 am 12:11 AM

在MySQL中處理字符串數據類型和索引的最佳實踐包括:1)選擇合適的字符串類型,如CHAR用於固定長度,VARCHAR用於可變長度,TEXT用於大文本;2)謹慎索引,避免過度索引,針對常用查詢創建索引;3)使用前綴索引和全文索引優化長字符串搜索;4)定期監控和優化索引,保持索引小巧高效。通過這些方法,可以在讀取和寫入性能之間取得平衡,提升數據庫效率。

mysql:如何遠程添加用戶mysql:如何遠程添加用戶May 12, 2025 am 12:10 AM

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

MySQL字符串數據類型的最終指南:有效的數據存儲MySQL字符串數據類型的最終指南:有效的數據存儲May 12, 2025 am 12:05 AM

tostorestringsefliceflicyInmySql,ChooSetherightDataTypeBasedyOrneOrneEds:1)USEcharforFixed-LengthStstringStringStringSlikeCountryCodes.2)UseVarcharforvariable-lengtthslikenames.3)USETEXTCONTENT.3)

mysql blob vs.文本:為大對象選擇正確的數據類型mysql blob vs.文本:為大對象選擇正確的數據類型May 11, 2025 am 12:13 AM

選擇MySQL的BLOB和TEXT數據類型時,BLOB適合存儲二進制數據,TEXT適合存儲文本數據。 1)BLOB適用於圖片、音頻等二進制數據,2)TEXT適用於文章、評論等文本數據,選擇時需考慮數據性質和性能優化。

MySQL:我應該將root用戶用於產品嗎?MySQL:我應該將root用戶用於產品嗎?May 11, 2025 am 12:11 AM

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQL字符串數據類型說明了:選擇適合您數據的合適類型MySQL字符串數據類型說明了:選擇適合您數據的合適類型May 11, 2025 am 12:10 AM

mySqlStringDatatAtatPessHouldBechoseBasedondatActarActeristicsAndusecases:1)USEcharforFixed lengthStstringStringStringSlikeCountryCodes.2)usevarcharforvariable-lengtthslikeLikenames.3)usebarnionororvarinyorvarinyorvarybinarydatalgebenedaTalgeextocrabextrapon.4)

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具