mysql - 如何解决 "Error: MySQL shutdown unexpectedly"?

当我打开 XAMPP 并单击启动 MySQL 按钮时,它给了我一个错误。 我之前也启动过,现在不行了。

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

这是错误日志的内容:

2013-08-02 12:19:12 4536 [Note] Plugin 'FEDERATED' is disabled.
2013-08-02 12:19:12 f64 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.
2013-08-02 12:19:12 4536 [Note] InnoDB: The InnoDB memory heap is disabled
2013-08-02 12:19:12 4536 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2013-08-02 12:19:12 4536 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-08-02 12:19:12 4536 [Note] InnoDB: Not using CPU crc32 instructions
2013-08-02 12:19:12 4536 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2013-08-02 12:19:12 4536 [Note] InnoDB: Completed initialization of buffer pool
2013-08-02 12:19:12 4536 [Note] InnoDB: Highest supported file format is Barracuda.
2013-08-02 12:19:12 4536 [Note] InnoDB: The log sequence numbers 0 and 0 in ibdata files do not match the log sequence number 1616798 in the ib_logfiles!
2013-08-02 12:19:12 4536 [Note] InnoDB: Database was not shutdown normally!
2013-08-02 12:19:12 4536 [Note] InnoDB: Starting crash recovery.
2013-08-02 12:19:12 4536 [Note] InnoDB: Reading tablespace information from the .ibd files...

最重要的错误信息在这里:

2013-08-02 12:19:12 4536 [ERROR] InnoDB:
Attempted to open a previously opened tablespace.
Previous tablespace mysql/innodb_table_stats uses space ID: 1 at filepath: .\mysql\innodb_table_stats.ibd.
Cannot open tablespace xat/payments which uses space ID: 1 at filepath: .\xat\payments.ibd

日志的其余部分:

InnoDB: Error: could not open single-table tablespace file .\xat\payments.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.

这些错误的原因是什么,我该如何纠正它们?

最佳答案

IMPORTANT: do NOT delete ibdata1 file. You could destroy all your databases.

相反,首先尝试使用 XAMPP 中包含的 MySQL 备份文件夹。接下来的步骤也是如此:

  1. 将文件夹 mysql/data 重命名为 mysql/data_old
  2. 复制 mysql/backup 文件夹并将其命名为 mysql/data
  3. 将所有数据库文件夹从mysql/data_old复制到mysql/data(mysqlperformance_schema除外,和 phpmyadmin 文件夹)
  4. mysql/data_old/ibdata1文件复制到mysql/data文件夹中
  5. 从 XAMPP 控制面板启动 MySQL

然后,瞧!

关于mysql - 如何解决 "Error: MySQL shutdown unexpectedly"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18022809/

相关文章:

mysql - UNION 和 ORDER BY 的使用不正确?

mysql - 什么 MySQL 类型最适合 "price"列?

sql - 你能在 SQL 中定义 "literal"表吗?

mysql - 允许所有远程连接,MySQL

sql - ON子句中的MySQL未知列

mysql - 如何将数据库从 Amazon RDS MySQL 实例导出到本地实例?

mysql - 错误 : select command denied to user '

python - MySQL:从查询中获取列名或别名

mysql - 在 Rails 迁移 (MySQL) 中,您能否指定新列的位置?

java - 如何解决无法加载身份验证插件 'caching_sha2_password' 问题