mysql重启后Incorrect information in file相关的错误

  • user warning: Table './zgq_smzz/blog_comments' is marked as crashed and should be repaired query: SELECT COUNT(*) FROM blog_comments c WHERE c.nid = 55 AND c.status = 0 in /home/www/zhouguoqiang/zhoume.org/modules/comment/comment.module on line 992.
  • user warning: Table './zgq_smzz/blog_comments' is marked as crashed and should be repaired query: SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.signature_format, u.picture, u.data, c.thread, c.status FROM blog_comments c INNER JOIN blog_users u ON c.uid = u.uid WHERE c.nid = 55 AND c.status = 0 ORDER BY c.thread DESC LIMIT 0, 50 in /home/www/zhouguoqiang/zhoume.org/modules/comment/comment.module on line 992.

修改完/etc/my.cnf的配置一直没有重启,今天重启了一下,看似一切正常,但是却没法访问原有的数据表,出现类似的提示:
Incorrect information in file: './DATABASE_NAME/TABLE_NAME.frm'

仔细查看mysql的错误日志文件,发现提示ib_logfile0文件大小设置不正确:

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

下面即时具体受影响的数据表信息。

显然mysql启动时会对比ib_logfileN和配置里设置的文件大小,可见是我更改innodb_log相关的配置导致的:
> innodb_log_file_size = 256M
> innodb_log_files_in_group = 3
< innodb_log_file_size = 5M
< innodb_log_files_in_group = 2

改回以前配置就没有问题了。

另外,把相应的ib_logfile删除了,启动时也可以再生成一份。

参考:
http://forums.mysql.com/read.php?22,181434,181701
http://sech.javaeye.com/blog/462740

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options