【问题标题】:MySQL shutdown unexpectedlyMySQL 意外关闭
【发布时间】:2014-03-14 19:13:21
【问题描述】:

我知道这个问题在这里被问过很多次,我搜索了很多,找到了各种答案,但仍然无法解决我的问题。

Apache 在 80 端口成功运行,但是当我尝试启动 mysql 时,它给了我以下错误消息。

13:36:13  [mysql] Error: MySQL shutdown unexpectedly.
13:36:13  [mysql] This may be due to a blocked port, missing dependencies, 
13:36:13  [mysql] improper privileges, a crash, or a shutdown by another method.
13:36:13  [mysql] Press the Logs button to view error logs and check
13:36:13  [mysql] the Windows Event Viewer for more clues
13:36:13  [mysql] If you need more help, copy and post this
13:36:13  [mysql] entire log window on the forums

日志文件

140215 13:36:13 [Note] Plugin 'FEDERATED' is disabled.
140215 13:36:13 InnoDB: The InnoDB memory heap is disabled
140215 13:36:13 InnoDB: Mutexes and rw_locks use Windows interlocked functions
140215 13:36:13 InnoDB: Compressed tables use zlib 1.2.3
140215 13:36:13 InnoDB: Initializing buffer pool, size = 16.0M
140215 13:36:13 InnoDB: Completed initialization of buffer pool
InnoDB: Error: space header page consists of zero bytes in data file D:\xampp\mysql\data\ibdata1
140215 13:36:13 InnoDB: Could not open or create data files.
140215 13:36:13 InnoDB: If you tried to add new data files, and it failed here,
140215 13:36:13 InnoDB: you should now edit innodb_data_file_path in my.cnf back
140215 13:36:13 InnoDB: to what it was, and remove the new ibdata files InnoDB created
140215 13:36:13 InnoDB: in this failed attempt. InnoDB only wrote those files full of
140215 13:36:13 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
140215 13:36:13 InnoDB: remove old data files which contain your precious data!
140215 13:36:13 [ERROR] Plugin 'InnoDB' init function returned error.
140215 13:36:13 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140215 13:36:13 [ERROR] Unknown/unsupported storage engine: InnoDB
140215 13:36:13 [ERROR] Aborting

请指导我如何解决此问题。

问候, 阿夫塔布

【问题讨论】:

  • 您的数据库文件可能已损坏(D:\xampp\mysql\data\ibdata1)?或者你指向了错误的路径
  • 我在帖子中发现了ibdata文件删除后它会正常工作,这就是我删除它的原因。
  • 当您删除了 ibdata1 时,您是否也从 MySQL 目录中删除了 ib_logfile0、ib_logfile1?如果不尝试这样做,让 InnoDB 再次加载并启动 MySQL。为了预防起见,您可以保留这些文件的副本,而不是直接删除
  • 我已经用 ibdata1 删除了 logfile0、logfile1。现在它没有给我任何错误消息,并在 phpmyadmin 中显示数据库名称,但是当我单击任何表名时,它会显示“abc 表为空”。请告诉我为什么它不显示表格数据。
  • 让我猜猜。因为您的表数据在您已删除的 ibdata1 中?

标签: php mysql apache xampp


【解决方案1】:

您可能想看看这里: https://superuser.com/questions/653953/cant-start-mysql-xampp-after-installing-on-external-drive

希望您在删除之前复制文件?

【讨论】:

  • 我已经用 ibdata1 删除了 logfile0、logfile1。现在它没有给我任何错误消息,并在 phpmyadmin 中显示数据库名称,但是当我单击任何表名时,它会显示“abc 表为空”。请告诉我为什么它不显示表格数据。
  • 好吧,如果您删除了 ibdata 文件(其中包含数据),那么您将看不到任何否,这很合乎逻辑?
  • ibdata 又回来了,但是除了 cdcol 数据库之外的表中没有数据。
  • 它可能已经恢复了一些旧数据,但丢失的数据恐怕要你自己放回去
【解决方案2】:

我遇到了类似的错误,并设法解决了这个问题:

转到 Xampp/mysql/bin/my.ini

添加以下行:

innodb_force_recovery = 1 

(我认为任何 > 0 的东西都可以在这里工作……为了安全起见,备份文件可能会很方便。)

您现在应该可以成功启动您的 mySQL 服务了。

【讨论】:

  • 问题已解决,但现在我得到的是空数据库。当我点击任何表名时,它说表是空的。
  • 这可能是因为您弄乱了 ibdata1 文件。如果你这样做,你的桌子会丢失:c
猜你喜欢
  • 2015-06-10
  • 2019-08-12
  • 2020-03-28
  • 2018-04-24
  • 2020-07-27
  • 2023-03-16
相关资源
最近更新 更多