MySQL 在服务启动时崩溃。遇到错误?数据库损坏?

MySQL 在服务启动时崩溃。遇到错误?数据库损坏?

我有一个 Web 服务器目前处于离线状态,因为 MySQL 启动异常。我找不到问题的根本原因,但我担心数据库损坏会导致 MySQL 服务崩溃。

以下是/var/log/mysql/mysqld.err输出:

==> /var/log/mysql/mysqld.err <==
2015-02-11 23:45:11 25171 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=mysqld-bin' to avoid this problem.
2015-02-11 23:45:11 25171 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-02-11 23:45:11 25171 [Note] InnoDB: The InnoDB memory heap is disabled
2015-02-11 23:45:11 25171 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-02-11 23:45:11 25171 [Note] InnoDB: Memory barrier is not used
2015-02-11 23:45:11 25171 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-02-11 23:45:11 25171 [Note] InnoDB: Using Linux native AIO
2015-02-11 23:45:11 25171 [Note] InnoDB: Using CPU crc32 instructions
2015-02-11 23:45:11 25171 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-02-11 23:45:11 25171 [Note] InnoDB: Completed initialization of buffer pool
2015-02-11 23:45:11 25171 [Note] InnoDB: Highest supported file format is Barracuda.
2015-02-11 23:45:11 25171 [Note] InnoDB: The log sequence numbers 43953950155 and 43953950155 in ibdata files do not match the log sequence number 43955508491 in the ib_logfiles!
2015-02-11 23:45:11 25171 [Note] InnoDB: Database was not shutdown normally!
2015-02-11 23:45:11 25171 [Note] InnoDB: Starting crash recovery.
2015-02-11 23:45:11 25171 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-02-11 23:45:11 25171 [Note] InnoDB: Restoring possible half-written data pages 
2015-02-11 23:45:11 25171 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Last MySQL binlog file position 0 107020, file name ./mysqld-bin.000052
01:45:11 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

key_buffer_size=16777216
read_buffer_size=262144
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 134417 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x3c)[0x7f122fe0d18c]
/usr/sbin/mysqld(handle_fatal_signal+0x3c9)[0x7f122fc00c29]
/lib64/libpthread.so.0(+0x102b0)[0x7f122e4ef2b0]
/usr/sbin/mysqld(+0x792dd9)[0x7f122ff7bdd9]
/usr/sbin/mysqld(+0x799787)[0x7f122ff82787]
/usr/sbin/mysqld(+0x71a1bd)[0x7f122ff031bd]
/usr/sbin/mysqld(+0x66f175)[0x7f122fe58175]
/usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x41)[0x7f122fb65f41]
/usr/sbin/mysqld(+0x487c32)[0x7f122fc70c32]
/usr/sbin/mysqld(_Z11plugin_initPiPPci+0x5fc)[0x7f122fc7425c]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x7cb)[0x7f122fb5e7eb]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f122db379f5]
/usr/sbin/mysqld(+0x36c3d8)[0x7f122fb553d8]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

此次崩溃发生在mysql-5.6.22

知道发生什么事了吗?

答案1

您的数据库已损坏(非常严重),这会导致 mysql 崩溃。

附注:这种情况只会在极少数情况下发生,例如内核冻结或断电,同时强制将 innodb_flush_log_at_trx_commit 设置为 2,或者使用强制打开写缓存但没有备用电池的 raid 控制器。

如果您必须恢复数据,您可以尝试将 innodb_force_recovery 设置为非零值来启动 mysql - 首先尝试将其设置为 1,看看 mysql 是否启动,如果是,则对数据库执行 mysqldump;如果值 1 没有帮助,请尝试 2​​,依此类推。

更多详细信息请参阅 mysql 文档:

http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html

相关内容