InnoDB:错误:日志文件./ib_logfile0大小不同

在我将一个数据库转换为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 

但它会提出“错误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引擎上的第一个数据库,因此该日志文件何时何地创build? 在这种情况下,如何在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! 

parsing度

在删除/ var / lib / mysql中的ib_logfile0和ib_logfile1之后,它现在可以工作了

    InnoDB对configuration非常挑剔; 如果事情不对,就放弃回家。 要更改日志文件大小而不丢失数据:

    1. 恢复您对日志文件大小所做的任何configuration更改并重新启动MySQL。
    2. 在你运行MySQL时:SET GLOBAL innodb_fast_shutdown = 0;
    3. 停止MySQL
    4. 将configuration更改为日志文件大小。
    5. 删除这两个日志文件。
    6. 启动MySQL。 它会抱怨缺less日志文件,但会创build它们,一切都会好的。