MySQL 崩溃。原因不明。信号 11

MySQL 崩溃。原因不明。信号 11

这是我大约 6 个月前安装的数据库,一直运行良好。它目前在 Ubuntu 12.04 中运行。尝试连接到 MySQL 会导致此错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

然后是:

$ sudo mysqld

返回:

130702 15:38:54 [Note] Plugin 'FEDERATED' is disabled.
130702 15:38:54 InnoDB: The InnoDB memory heap is disabled
130702 15:38:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130702 15:38:54 InnoDB: Compressed tables use zlib 1.2.3.4
130702 15:38:54 InnoDB: Initializing buffer pool, size = 128.0M
130702 15:38:54 InnoDB: Completed initialization of buffer pool
130702 15:38:54 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!
130702 15:38:54  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...
130702 15:38:55  InnoDB: Waiting for the background threads to start
130702 15:38:56 InnoDB: 1.1.8 started; log sequence number 5201901917
130702 15:38:56 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
130702 15:38:56 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
130702 15:38:56 [Note] Server socket created on IP: '127.0.0.1'.
130702 15:38:56 [Note] Event Scheduler: Loaded 0 events
130702 15:38:56 [Note] mysqld: ready for connections.
Version: '5.5.28-0ubuntu0.12.04.3'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
19:39:02 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=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346681 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f9509e51530
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 = 7f94f1d3de60 thread_stack 0x30000
mysqld(my_print_stacktrace+0x29)[0x7f95083427b9]
mysqld(handle_fatal_signal+0x483)[0x7f9508209b43]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f9506f5bcb0]
mysqld(+0x320e1c)[0x7f9508113e1c]
mysqld(_ZN4JOIN15alloc_func_listEv+0x9c)[0x7f950812391c]
mysqld(_ZN4JOIN7prepareEPPP4ItemP10TABLE_LISTjS1_jP8st_orderS7_S1_S7_P13st_select_lexP18st_select_lex_unit+0x918)[0x7f9508124658]
mysqld(_Z12mysql_selectP3THDPPP4ItemP10TABLE_LISTjR4ListIS1_ES2_jP8st_orderSB_S2_SB_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x130)[0x7f950812d060]
mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x17c)[0x7f9508132fbc]
mysqld(+0x2f6714)[0x7f95080e9714]
mysqld(_Z21mysql_execute_commandP3THD+0x16d8)[0x7f95080f1178]
mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x10f)[0x7f95080f5e0f]
mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1380)[0x7f95080f7260]
mysqld(_Z24do_handle_one_connectionP3THD+0x1bd)[0x7f950819b80d]
mysqld(handle_one_connection+0x50)[0x7f950819b870]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a)[0x7f9506f53e9a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f9506684cbd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f94e0004b80): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED

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.

我不知所措。还有哪些报告有助于诊断这种情况? /var/log/mysql.err&/var/log/mysql.log是空的。

答案1

看起来您已经成为正在发生的错误的受害者。

由于某些未知原因,该mysql.sock文件往往会毫无警告地消失:

我已经多次处理过这种情况,以下是我过去处理过此情况的帖子:

解决此问题的方法是使用 TCP/IP 协议登录 mysql。只要您有:

  • 您有一个名为 MySQL 用户[email protected]
  • 您可以使用--protocol=tcpmysql 客户端的选项
  • 您未使用skip-networking

你可以像这样登录mysql:

mysql -uroot -h127.0.0.1 --protocol=tcp -p

如果你可以做到这一点,那么关闭 mysql 并启动它将会像这样修复它:

mysqladmin -uroot -h127.0.0.1 --protocol=tcp -p shutdown
service mysql start

这将恢复文件mysql.sock。这解释了为什么重新启动操作系统也能解决问题。

回到问题,你输入了

sudo mysqld

MySQL 已在运行,而您正尝试再次启动 mysqld,因此出现奇怪的消息。

相关内容