InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes

1.版本

1)操作系统

 cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel \r on an \m

 cat /proc/version
Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed 

2)mysql数据库版本

mysql --version
mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1


2.问题描述

  一次在修改my.cnf文件后重启mysql实例发现如下错误:

mysql> desc cMxxPxhCoxf;
ERROR 1286 (42000): Unknown table engine 'InnoDB'
查看errlog发现如下报错:

<span style="color:#333333;">151202 18:18:36 mysqld_safe Starting mysqld daemon with databases from /data/mysql
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
151202 18:18:36 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
151202 18:18:36  InnoDB: Initializing buffer pool, size = 3.9G
151202 18:18:37  InnoDB: Completed initialization of buffer pool
</span><span style="color:#ff0000;">InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes >>因为我们cnf文件中指定的innodb log size和之前不一致</span><span style="color:#333333;">
InnoDB: than specified in the .cnf file 0 67108864 bytes!
151202 18:18:37 [ERROR] Plugin 'InnoDB' init function returned error.
151202 18:18:37 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151202 18:18:37 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
151202 18:18:37 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50157, now running 50173. Please use mysql_upgrade to fix this error.
151202 18:18:37 [ERROR] mysql.user has no `Event_priv` column at position 29
151202 18:18:37 [ERROR] Cannot open mysql.event
151202 18:18:37 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
151202 18:18:37 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution</span>
##从上面标红我们可以知道问题是因为修改my.cnf文件中修改了innodb_log_file_size值,在5.6之前如果要修改innodb_log_file_size值,需要先移走已有的ib_logfile文件,否则启动就会报上面的错,从而导致innodb的表不能使用。

3.问题解决

3.1 方案1

3.1.1 停mysql实例

mysqladmin -uroot -p -S /var/lib/mysql/mysql.sock shutdown

3.1.2 修改my.cnf文件中innodb_log_file_size值为原来值

即修改innodb_log_file_size=5242880

3.1.3 以修改后的my.cnf重启mysql实例

mysqld_safe --defaults-file=/etc/my.cnf &


3.2 方案2

3.2.1 停mysql实例

mysqladmin -uroot -p -S /var/lib/mysql/mysql.sock shutdown

3.2.2 修改原有ib_logfile文件名

mv ib_logfile0 ib_logfile0.bak

mv ib_logfile1 ib_logfile1.bak

3.2.3 启动mysql实例

mysqld_safe --defaults-file=/etc/my.cnf &



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

渔夫数据库笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值