mysql 无法启动 - innoDB:数据库未正常关闭

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14805226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 16:30:21  来源:igfitidea点击:

mysql wont start - innoDB: Database was not shut down normally

mysql

提问by Haryo Bergas

My office's mysql server is suddenly down and won't start. I used XAMPP. when look into the log it shown like this:

我办公室的mysql服务器突然宕机,无法启动。我使用了 XAMPP。查看日志时,它显示如下:

130211  9:45:04 [Note] Plugin 'FEDERATED' is disabled.
130211  9:45:04 InnoDB: The InnoDB memory heap is disabled
130211  9:45:04 InnoDB: Mutexes and rw_locks use Windows interlocked functions
130211  9:45:04 InnoDB: Compressed tables use zlib 1.2.3
130211  9:45:04 InnoDB: Initializing buffer pool, size = 16.0M
130211  9:45:04 InnoDB: Completed initialization of buffer pool
130211  9:45:04 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130211  9:45:04  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...

Does anyone know why this is happen? I am really need advice, my boss is getting mad.. :D

有谁知道为什么会这样?我真的需要建议,我的老板生气了.. :D

回答by Bill Karwin

This is normal output after a crash. InnoDB is designed to recover automatically in these cases, but it may take some time. Usually minutes, but possibly hours if the crash occurred when you had thousands of pages of modified data in memory, and your disks are slow.

这是崩溃后的正常输出。InnoDB 旨在在这些情况下自动恢复,但可能需要一些时间。通常需要几分钟,但如果在内存中有数千页修改过的数据并且磁盘速度很慢时发生崩溃,则可能需要数小时。

Despite what @tadman says, it's not necessarily going to trash your data. InnoDB can recover by itself in most cases, with no data loss.

尽管@tadman 说了些什么,但它不一定会破坏您的数据。InnoDB 在大多数情况下可以自行恢复,不会丢失数据。

It is possible for InnoDB to be corrupted in a crash more severely, and it's possible that it won't be able to recover in all cases. But the error log output you show doesn't show any report of unrecoverable damage. The messages are normal output when starting up the MySQL Service after a crash. Wait for it to complete until it says "ready for connections" and then connect and do some ad hoc queries to check if the data looks correct to you.

InnoDB 有可能在崩溃中更严重地损坏,并且可能无法在所有情况下恢复。但是您显示的错误日志输出没有显示任何不可恢复损坏的报告。崩溃后启动 MySQL 服务时,消息是正常输出。等待它完成,直到它说“准备好连接”,然后连接并执行一些临时查询以检查数据对您来说是否正确。

As for what caused the crash, there are many possible causes. For instance, it would happen if you powered off the computer suddenly. Or if you killed the MySQL Service. You asked about viruses in another comment. In theory, a virus could deliberately kill the MySQL Service.

至于导致崩溃的原因,有很多可能的原因。例如,如果您突然关闭计算机电源,就会发生这种情况。或者,如果您杀死了 MySQL 服务。您在另一条评论中询问了病毒。理论上,病毒可以故意杀死 MySQL 服务。

Or possibly it's due to a software bug in MySQL.

或者可能是由于 MySQL 中的软件错误。

That's right -- all software contains bugs! Your boss can get mad about it, he can even demand to throw MySQL out and switch to some other database. But there's no database software in the world that is 100% immune to bugs that cause crashes.

没错——所有软件都包含错误!你的老板可能会为此生气,他甚至可以要求将 MySQL 扔掉并切换到其他数据库。但是世界上没有任何数据库软件可以 100% 避免导致崩溃的错误。

回答by tadman

You trashed your server's InnoDB tables by hard crashing. Sometimes you will need to adjust a setting in my.cnfto enable recovery mode. Often the tables are in read-only mode so you will have to make back-ups, clear out your MySQL data directory, and re-initialize MySQL with mysql-install-dbto start from scratch.

您通过硬崩溃破坏了服务器的 InnoDB 表。有时您需要调整设置my.cnf以启用恢复模式。通常这些表处于只读模式,因此您必须进行备份,清除 MySQL 数据目录,并重新初始化 MySQL 以mysql-install-db从头开始。

This should serve as a reminder to back up any and all important data.

这应该作为备份任何和所有重要数据的提醒。