我将一个数据库转换为使用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
但是,它会在重新启动mysqld时引发“错误2(HY000)在第2行:在查询期间与MySQL服务器的连接丢失”错误。和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之后,它现在可以工作