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 ([email protected]) (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 &



你可能感兴趣的:(error,error,error,log,InnoDB,InnoDB,InnoDB,Lock,plugin,plugin,open,p,and,Cant,1286,fil,REGIST,Unk,42000)