<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>惜分飞 &#187; 修改ib_logfile</title>
	<atom:link href="https://www.xifenfei.com/tag/%e4%bf%ae%e6%94%b9ib_logfile/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Thu, 29 Oct 2026 15:31:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>修改MySQL的ib_logfile大小和组数</title>
		<link>https://www.xifenfei.com/2022/07/modify-ib_logfile-size-and-groups.html</link>
		<comments>https://www.xifenfei.com/2022/07/modify-ib_logfile-size-and-groups.html#comments</comments>
		<pubDate>Sat, 16 Jul 2022 07:26:51 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[修改ib_logfile]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=9832</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2022/07/modify-ib_logfile-size-and-groups.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2022/07/modify-ib_logfile-size-and-groups.html" target="_blank">修改MySQL的ib_logfile大小和组数</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>在某些情况下，需要修改MySQL的ib_logfile大小和组数(类似oracle redo),以下演示在MySQL 8.0修改ib_logfile大小和组数操作<br />
<strong>查看当前ib_logfile情况</strong></p>
<pre class="brush: sql; title: ; notranslate">
mysql&gt; select version();
+-----------+
| version() |
+-----------+
| 8.0.21    |
+-----------+
1 row in set (0.00 sec)

mysql&gt; show variables like '%innodb_log_file%';
+---------------------------+-----------+
| Variable_name             | Value     |
+---------------------------+-----------+
| innodb_log_file_size      | 134217728 |
| innodb_log_files_in_group | 2         |
+---------------------------+-----------+
2 rows in set, 1 warning (0.00 sec)

mysql&gt; show variables like '%innodb_log_group_home_dir%';
+---------------------------+-------+
| Variable_name             | Value |
+---------------------------+-------+
| innodb_log_group_home_dir | .\    |
+---------------------------+-------+
1 row in set, 1 warning (0.00 sec)

mysql&gt; show variables like '%datadir%';
+---------------+---------------+
| Variable_name | Value         |
+---------------+---------------+
| datadir       | E:\MySQL\8.0\ |
+---------------+---------------+
1 row in set, 1 warning (0.00 sec)

C:\Users\XFF&gt;dir E:\MySQL\8.0\ib_log*
 驱动器 E 中的卷是 SSD
 卷的序列号是 98A5-7F8E

 E:\MySQL\8.0 的目录

2022-07-16  14:14       134,217,728 ib_logfile0
2022-07-03  17:30       134,217,728 ib_logfile1
               2 个文件    268,435,456 字节
               0 个目录 807,501,471,744 可用字节
</pre>
<p>当前ib_logfile成员为2个,每个128M,后续计划修改为成为3个,每个256M<br />
<br />
<strong>修改my.ini参数</strong></p>
<pre class="brush: bash; title: ; notranslate">
innodb_log_files_in_group=3
innodb_log_file_size=256M
</pre>
<p><strong>重启mysql服务</strong></p>
<pre class="brush: bash; title: ; notranslate">
C:\Users\XFF&gt;dir E:\MySQL\8.0\ib_log*
 驱动器 E 中的卷是 SSD
 卷的序列号是 98A5-7F8E

 E:\MySQL\8.0 的目录

2022-07-16  14:19       268,435,456 ib_logfile0
2022-07-16  14:19       268,435,456 ib_logfile1
2022-07-16  14:19       268,435,456 ib_logfile2
               3 个文件    805,306,368 字节
               0 个目录 806,964,072,448 可用字节


mysql&gt; show variables like '%innodb_log_file%';
+---------------------------+-----------+
| Variable_name             | Value     |
+---------------------------+-----------+
| innodb_log_file_size      | 268435456 |
| innodb_log_files_in_group | 3         |
+---------------------------+-----------+
2 rows in set, 1 warning (0.00 sec)
</pre>
<p>在8.0版本中直接修改成功,如果是以前MySQL版本,修改过程可能遭遇InnoDB: Error: log file ./ib_logfile0 is of different size 0 268435456 bytes错误,类似这样的需要删除ib_logfile文件,启动MySQL服务重新生成ib_logfile文件(在8.0版本中直接自动删除并重建)</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2016/12/mysql-ibd-recovery.html" rel="bookmark" class="crp_title">[MySQL异常恢复]mysql ibd文件恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/mysql%e5%85%b3%e4%ba%8elog_bin%e7%9b%b8%e5%85%b3%e5%91%bd%e4%bb%a4.html" rel="bookmark" class="crp_title">mysql关于log_bin相关命令</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/mysql-cluster-7-x%e5%ae%89%e8%a3%85%ef%bc%88linux%ef%bc%89.html" rel="bookmark" class="crp_title">mysql-cluster 7.x安装（linux）</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/mysqld_safe%e5%90%af%e5%8a%a8%e6%8a%a5%e9%94%99.html" rel="bookmark" class="crp_title">mysqld_safe启动报错</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/mysql-%e5%ae%89%e8%a3%85%e5%b9%b6%e5%90%af%e5%8a%a8%e5%a4%9a%e4%b8%aa%e5%ae%9e%e4%be%8b.html" rel="bookmark" class="crp_title">mysql 安装并启动多个实例</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/mysql-cluster-7-x%e5%ae%89%e8%a3%85%ef%bc%88windows%ef%bc%89.html" rel="bookmark" class="crp_title">mysql-cluster 7.x安装（windows）</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/06/mysql%e4%bf%ae%e6%94%b9%e5%af%86%e7%a0%81.html" rel="bookmark" class="crp_title">MYSQL修改密码</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/mysqldumpmysqlbinlog%e6%81%a2%e5%a4%8d%e6%b5%8b%e8%af%95.html" rel="bookmark" class="crp_title">mysqldump+mysqlbinlog恢复测试</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/07/%e9%80%9a%e8%bf%87substring_index%e5%92%8csubstring%e6%88%aa%e5%8f%96%e5%ad%97%e7%ac%a6%e4%b8%b2.html" rel="bookmark" class="crp_title">mysql通过substring_index和substring截取字符串</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/mysql-5-5%e4%ba%8c%e8%bf%9b%e5%88%b6%e6%96%87%e4%bb%b6%e5%ae%89%e8%a3%85.html" rel="bookmark" class="crp_title">mysql 5.5二进制文件安装</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/04/mysql%e4%b8%ad%e9%81%87%e5%88%b0%e9%94%99%e8%af%af.html" rel="bookmark" class="crp_title">mysql中遇到错误</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/08/mysql%e5%bc%82%e5%b8%b8%e6%81%a2%e5%a4%8dmysql-delete-%e6%95%b0%e6%8d%ae%e6%81%a2%e5%a4%8d.html" rel="bookmark" class="crp_title">[MySQL异常恢复]mysql delete 数据恢复</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2022/07/modify-ib_logfile-size-and-groups.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
