本文介绍了更改innodb_log_file_size的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去我没有做太多的调整,因此这可能相对容易,但是我遇到了问题.这就是我要做的:

I haven't done much tweaking in the past so this might be relatively easy however I am running into issues. This is what I do:

  1. 停止MySQL
  2. 编辑my.cnf(更改innodb_log_file_size)
  3. 删除ib_logfile0/1
  4. 启动MySQL
  1. Stop MySQL
  2. Edit my.cnf (changing innodb_log_file_size)
  3. Remove ib_logfile0/1
  4. Start MySQL

一切正常,但是所有InnoDB表都有.frm文件无效错误,状态显示InnoDB引擎已禁用,因此我显然回去了,删除更改,然后一切恢复正常.

Starts fine however all InnoDB tables have the .frm file is invalid error, the status shows InnoDB engine is disabled so I obviously go back, remove the change and everything works again.

我能够更改我尝试过的所有其他变量,但是即使删除日志文件后,我似乎也无法找出为什么InnoDB无法启动.我想念什么吗?

I was able to change every other variable I've tried but I can't seem to find out why InnoDB fails to start even after removing the log files. Am I missing something?

谢谢.

在下面粘贴日志-看起来似乎仍然可以找到日志文件,即使它们不存在吗?

Pasting of the log below - looks like it still seems to find the log file even though they are not there?

关机:

090813 10:00:14  InnoDB: Starting shutdown...
090813 10:00:17  InnoDB: Shutdown completed; log sequence number 0 739268981
090813 10:00:17 [Note] /usr/sbin/mysqld: Shutdown complete

进行更改后启动:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
090813 11:00:18 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode.
090813 11:00:18 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.81-community-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Edition (GPL)
090813 11:00:19 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './XXXX/User.frm'
090813 11:00:19 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './XXXX/User.frm'
090813 11:00:19 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './XXXX/User.frm'

在我纠正之前,它只是一个具有相同错误的垃圾邮件

Its just a spam of the same error until I correct it

它在重新创建日志文件后确实启动时,因此它必须与我位于同一位置.

When it did start after it recreated the log files so it must be looking in the same spot I am.

推荐答案

首先,我必须指出,在对InnoDB数据文件进行任何修改之前,应该先阅读 13.2.5.添加,删除或调整InnoDB数据和日志文件的大小.

First, I must point that before any chage in InnoDB data files, one should read 13.2.5. Adding, Removing, or Resizing InnoDB Data and Log Files.

您指出的步骤几乎是正确的.建议在进行此类更改之前先进行备份.让我们看看你发生了什么事:

The steps you pointed are almost correct. It´s recommended to backup before this types of changes. Lets see what happened to you:

错误消息

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!

是由于更改innodb_log_file_size的大小而引起的,请勿删除旧文件.可能是您在更改后第一次运行mysqld时忘记了删除de ib_logfile0/1.消息

are caused by changing the size of innodb_log_file_size and dont deleting the old files. Probably you forgot to delete de ib_logfile0/1 the first time you ran mysqld after the changing. The message

090813 11:00:18 [Note] /usr/sbin/mysqld: ready for connections.

显示您已解决此问题(通过删除ib_logfile s).但是,在删除它们时,您会遇到另一个问题. XXXX \ User.frm的数据损坏或InnoDB Engine出现问题.

shows that you resolved this problem (by removing ib_logfiles). But, on removing them you create the other problem. Data corrupt for XXXX\User.frm or some problem with InnoDB Engine.

要确保已启用InnoDB,请在mysql提示符下运行以下命令:

To be sure that InnoDB is enabled, run this command on a mysql prompt:

show variables like "%inno%";

在结果列表中必须具有"have_innodb = YES".有时当InnoDB无法 启动(值是NODISABLED)时,会出现Incorrect information in file消息.
-如果这是问题所在,则您已更改了其他阻止InnoDB Engine正常启动的功能(datadir的权限或tmpdir的权限,其他innodb变量(您没有显示完整的日志.),等等.).查看更改或放置.cnf文件(之前和之后).
-如果InnoDB Engine是YES,则必须修复该表. (如果是这种情况,请添加评论,我将在此处添加信息.我现在懒得做.)

In the result list must have "have_innodb = YES". Sometimes when InnoDB can not start (value is NO or DISABLED) the Incorrect information in file message appears.
- If this is the problem, you have changed something else that prevents InnoDB Engine to start properly (datadir´s permissions or tmpdir´s permissions, other innodb variables (you didnt show the complete log.), etc.). Review the changes or put the .cnf files (before and after).
- If the InnoDB Engine is YES then you have to repair the table. (If it´s this case, add a comment and I´ll add the information here. I´m too lazy to do it now.)

这篇关于更改innodb_log_file_size的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 08:23