首页 > 技术文章 > mysq 因断电而导致的错误

hans-201506 2015-10-12 21:47 原文

问题来源:

昨天断电,而我没有保存,导致出现以下问题:

2015-10-12 10:48:10 7300 [Note] Plugin 'FEDERATED' is disabled.
2015-10-12 10:48:10 2080 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2015-10-12 10:48:10 7300 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-10-12 10:48:10 7300 [Note] InnoDB: The InnoDB memory heap is disabled
2015-10-12 10:48:10 7300 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-10-12 10:48:10 7300 [Note] InnoDB: Memory barrier is not used
2015-10-12 10:48:10 7300 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-10-12 10:48:10 7300 [Note] InnoDB: Not using CPU crc32 instructions
2015-10-12 10:48:10 7300 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2015-10-12 10:48:10 7300 [Note] InnoDB: Completed initialization of buffer pool
2015-10-12 10:48:10 7300 [Note] InnoDB: Restoring page 0 of tablespace 0
2015-10-12 10:48:10 7300 [Warning] InnoDB: Doublewrite does not have page_no=0 of space: 0
2015-10-12 10:48:10 7300 [ERROR] InnoDB: space header page consists of zero bytes in data file C:\xampp\mysql\data\ibdata1
2015-10-12 10:48:10 7300 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2015-10-12 10:48:10 7300 [ERROR] Plugin 'InnoDB' init function returned error.
2015-10-12 10:48:10 7300 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-10-12 10:48:10 7300 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-10-12 10:48:10 7300 [ERROR] Aborting

解决办法:

错误日志里已经告诉你了: C:\xampp\mysql\data\ibdata1 把这个下面的 ibdata1 和 ib_logfle0 ib_lofile1 删掉。

如果,数据库损坏了,在这个目录下,把数据库文件删掉删掉,然后重新建立即可。

以上方法 同样适用于 windows 和linux 

推荐阅读