2013-12-05 11:25:06

MySQL异常关闭后无法启动:MySQL Daemon failed to start 解决方案(CentOS下)

今天MySQL数据库占内存过大,导致网站时常出现500错误,按以下步骤解决:

1. 尝试/etc/init.d/mysqld stop 无响应,只得ps -ef | grep mysql 然后kill掉两个相关的mysql进程

2. 尝试/etc/init.d/mysqld start 不成功,查看mysql日志 cat /var/log/mysqld.log,发现以下错误:

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/libexec/mysqld(my_print_stacktrace+0x29) [0x84f539]
/usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3713]
/lib64/libpthread.so.0(+0xf500) [0x7f85469cb500]
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.
131103 11:25:24 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
131103 11:26:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
131103 11:26:49  InnoDB: Initializing buffer pool, size = 8.0M
131103 11:26:49  InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
131103 11:26:49  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...
InnoDB: Last MySQL binlog file position 0 787278622, file name /var/lib/mysql/log/mysql-bin.000014
131103 11:26:49  InnoDB: Started; log sequence number 0 1736090200
03:26:49 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=8384512
read_buffer_size=131072
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 = 338332 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/libexec/mysqld(my_print_stacktrace+0x29) [0x84f539]
/usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3713]
/lib64/libpthread.so.0(+0xf500) [0x7f37fa944500]
The m131103 11:26:49 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

看起来是InnerDB异常关闭的问题,网上搜索找到解决方案:

  • cd /var/lib/mysql
  • mkdir old
  • mv ib* old
  • /etc/init.d/mysql start

总结:最好还是正常等待mysql关闭吧,实在不行,再看这篇文章

发表回复