我决定将我的 XAMPP 安装移至外部驱动器。它是 USB3 3TB Seagate 驱动器。不幸的是,mysql 无法启动。如果我将 XAMPP 安装到 C 盘,一切都会正常,但当我在外部驱动器上尝试相同操作时,却不起作用。我多次卸载并重新启动计算机,清除了计算机上所有 mysql 的痕迹,但我仍然收到相同的错误。
这是全新安装,数据库中没有数据。我还删除了零字节数据文件,如错误日志所建议的那样,但每次我尝试重新启动时,文件都会再次创建。
这是日志文件内容:
131003 11:36:20 [Note] Plugin 'FEDERATED' is disabled.
131003 11:36:20 InnoDB: The InnoDB memory heap is disabled
131003 11:36:20 InnoDB: Mutexes and rw_locks use Windows interlocked functions
131003 11:36:20 InnoDB: Compressed tables use zlib 1.2.3
131003 11:36:20 InnoDB: Initializing buffer pool, size = 16.0M
131003 11:36:20 InnoDB: Completed initialization of buffer pool
InnoDB: Error: space header page consists of zero bytes in data file F:\design\code\mysql\data\ibdata1
131003 11:36:20 InnoDB: Could not open or create data files.
131003 11:36:20 InnoDB: If you tried to add new data files, and it failed here,
131003 11:36:20 InnoDB: you should now edit innodb_data_file_path in my.cnf back
131003 11:36:20 InnoDB: to what it was, and remove the new ibdata files InnoDB created
131003 11:36:20 InnoDB: in this failed attempt. InnoDB only wrote those files full of
131003 11:36:20 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
131003 11:36:20 InnoDB: remove old data files which contain your precious data!
131003 11:36:20 [ERROR] Plugin 'InnoDB' init function returned error.
131003 11:36:20 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
131003 11:36:20 [ERROR] Unknown/unsupported storage engine: InnoDB
131003 11:36:20 [ERROR] Aborting
131003 11:36:20 [Note] f:\design\code\mysql\bin\mysqld.exe: Shutdown complete
我已经尝试了其他主题中提到的一些建议,比如这个
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
仍然没有变化。如有任何帮助,我们将不胜感激。
编辑:已解决(见下文)
答案1
经过更多的研究、实验和头痛(这个问题从昨晚就困扰着我)后,我找到了解决方案。除了将上述更改添加到my.ini
文件之外
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
my.ini
我还将这一行添加到文件末尾
innodb_flush_method=normal
现在一切都很顺利。看起来这是一个与 2TB 以上硬盘上的大扇区大小相关的错误。此解决方案的源代码可以在这一页。
答案2
将您的后端更改为MyISAM
来自InnoDB
,您的mysql
编译没有InnoDB