mysql5.6以前的版本, 如果修改了innodb_log_file_size,然后重启mysqld,会报错:
InnoDB: Error: log file ./ib_logfile0 IS OF different SIZE 0 5242880 bytes
InnoDB: than specified IN the .cnf file 0 10485760 bytes!
因为mysqld检测到ib_logfile0的大小,与配置文件中指定的大小不一致。
正确的做法:
1 关闭mysql数据库 ,观察 错误日记的信息,确保正常关闭
2 修改innodb_log_file_size = 新的值。
3 使用mv 命令将ib_logfile0 ib_logfileN 做备份
4 重新启动数据库,并观察 错误日记的信息
5 如果启动成功,则删除之前备份的旧日志文件
5.6开始就没这么麻烦,修改完innodb_log_file_size,直接重启就行了。
2013-02-26 14:33:47 29891 [Warning] InnoDB: Resizing redo log FROM 2*3072 TO 2*6400 pages, LSN=1640004
2013-02-26 14:33:47 29891 [Warning] InnoDB: Starting TO DELETE AND rewrite log files.
2013-02-26 14:33:47 29891 [Note] InnoDB: Setting log file ./ib_logfile101 SIZE TO 100 MB
InnoDB: Progress IN MB: 100
2013-02-26 14:33:49 29891 [Note] InnoDB: Setting log file ./ib_logfile1 SIZE TO 100 MB
InnoDB: Progress IN MB: 100
2013-02-26 14:33:51 29891 [Note] InnoDB: Renaming log file ./ib_logfile101 TO ./ib_logfile0
2013-02-26 14:33:51 29891 [Warning] InnoDB: NEW log files created, LSN=1640004
2013-02-26 14:33:51 29891 [Note] InnoDB: 128 ROLLBACK segment(s) are active.
2013-02-26 14:33:51 29891 [Note] InnoDB: Waiting FOR purge TO START
2013-02-26 14:33:51 29891 [Note] InnoDB: 1.2.10 started; log SEQUENCE NUMBER 1640004
mysql真是越来越好用了。