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真是越來越好用了。