在我将一个数据库转换为使用InnoDB引擎后,我刚刚在/etc/
mysql/my.cnf中添加了以下行.
innodb_buffer_pool_size = 2560M
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 2
innodb_thread_concurrency = 16
innodb_flush_method = O_DIRECT
但它引发了“ERROR 2013(HY000)第2行:在查询期间丢失与MySQL服务器的连接”错误重启mysqld.并且mysql错误日志显示以下内容
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
100118 20:52:52 [ERROR] Plugin 'InnoDB' init function returned error.
100118 20:52:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
100118 20:52:52 [ERROR] Unknown/unsupported table type: InnoDB
100118 20:52:52 [ERROR] Aborting
所以我评论了这一行
# innodb_log_file_size = 256M
它成功重启了mysql.
我想知道mysql错误中显示的“5242880字节的日志文件”是什么?它是此服务器上InnoDB引擎上的第一个数据库,因此该日志文件何时何地创建?在这种情况下,如何在my.cnf中启用innodb_log_file_size指令?
编辑
我试图删除/ var / lib / mysql / ib_logfile0并重新启动mysqld但它仍然失败.它现在在错误日志中显示以下内容.
100118 21:27:11 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
InnoDB: Error: log file ./ib_logfile1 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
解析度
在删除/ var / lib / mysql中的ib_logfile0和ib_logfile1后,它现在可以正常工作