如何恢复崩溃的mysql服务器

时间:2015-10-21 23:43:30

标签: mysql server

我有一个应该运行MySQL的Debian挤压服务器,但是在重启后它会出现启动问题。尝试使用/etc/init.d/mysql start启动它会在syslog中生成此代码段:

Oct 20 07:13:08 hyperion mysqld_safe: Starting mysqld daemon with databases from /var/lib/mysql
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 [Note] Plugin 'FEDERATED' is disabled.
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Initializing buffer pool, size = 8.0M
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Completed initialization of buffer pool
Oct 20 07:13:08 hyperion mysqld: InnoDB: The log sequence number in ibdata files does not match
Oct 20 07:13:08 hyperion mysqld: InnoDB: the log sequence number in the ib_logfiles!
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Database was not shut down normally!
Oct 20 07:13:08 hyperion mysqld: InnoDB: Starting crash recovery.
Oct 20 07:13:08 hyperion mysqld: InnoDB: Reading tablespace information from the .ibd files...
Oct 20 07:13:08 hyperion mysqld: InnoDB: Restoring possible half-written data pages from the doublewrite
Oct 20 07:13:08 hyperion mysqld: InnoDB: buffer...
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Started; log sequence number 0 150617369
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'user'

在谷歌搜索错误后,我发现我必须通过启动服务器来修复表,然后从另一个终端访问它并运行以下命令:

mysql> use mysql
mysql> repair table host use_frm;
mysql> exit

但是,已经在use mysql命令,我在mysqld终端中得到了这一段文字:

151020  7:50:03 [Note] Plugin 'FEDERATED' is disabled.
151020  7:50:03  InnoDB: Initializing buffer pool, size = 8.0M
151020  7:50:03  InnoDB: Completed initialization of buffer pool
151020  7:50:03  InnoDB: Started; log sequence number 0 150617379
151020  7:50:03 [Note] mysqld: ready for connections.
Version: '5.1.63-0+squeeze1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Debian)
mysqld: malloc.c:3097: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
05:51:07 UTC - mysqld got signal 6 ;
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=10
max_threads=151
thread_count=10
connection_count=10
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346521 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f98cdbcac30
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 = 7f98c59a7e88 thread_stack 0x30000
mysqld(my_print_stacktrace+0x29) [0x7f98ccc7a689]
mysqld(handle_fatal_signal+0x483) [0x7f98cca8ea53]
/lib/libpthread.so.0(+0xeff0) [0x7f98cc1e0ff0]
/lib/libc.so.6(gsignal+0x35) [0x7f98cac831b5]
/lib/libc.so.6(abort+0x180) [0x7f98cac85fc0]
/lib/libc.so.6(+0x71dda) [0x7f98cacc2dda]
/lib/libc.so.6(+0x74d2d) [0x7f98cacc5d2d]
/lib/libc.so.6(__libc_malloc+0x70) [0x7f98cacc7a30]
mysqld(my_malloc+0x32) [0x7f98ccc64372]
mysqld(alloc_root+0xd5) [0x7f98ccc64bc5]
mysqld(push_warning(THD*, MYSQL_ERROR::enum_warning_level, unsigned int, char const*)+0x194) [0x7f98cca14a84]
mysqld(my_message_sql+0x141) [0x7f98cc980c51]
mysqld(my_error+0xd8) [0x7f98ccc66118]
mysqld(open_table_def(THD*, st_table_share*, unsigned int)+0xeec) [0x7f98cc9dd95c]
mysqld(get_table_share(THD*, TABLE_LIST*, char*, unsigned int, unsigned int, int*)+0x230) [0x7f98cc9cbb00]
mysqld(+0x3c454b) [0x7f98cc9d254b]
mysqld(open_table(THD*, TABLE_LIST*, st_mem_root*, bool*, unsigned int)+0x7d5) [0x7f98cc9d3645]
mysqld(open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int)+0x6ee) [0x7f98cc9d437e]
mysqld(open_normal_and_derived_tables(THD*, TABLE_LIST*, unsigned int)+0x1e) [0x7f98cc9d451e]
mysqld(mysqld_list_fields(THD*, TABLE_LIST*, char const*)+0x20) [0x7f98ccab1f60]
mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x17f2) [0x7f98cc999a02]
mysqld(do_command(THD*)+0xea) [0x7f98cc999caa]
mysqld(handle_one_connection+0x236) [0x7f98cc98b796]
/lib/libpthread.so.0(+0x68ca) [0x7f98cc1d88ca]
/lib/libc.so.6(clone+0x6d) [0x7f98cad2092d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f98cdbd5610):
Connection ID (thread ID): 16
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.

我尝试在官方论坛上发帖求助,但似乎主持人没有让我的帖子通过。我的调试技巧太差,无法弄清楚出了什么问题以及如何从数据库中挽救数据。我已经能够通过跳过授权表来暂时启动服务器,但是当我尝试使用mysqldump --all-databases > backup.sql转储数据库时,我遇到了另一个错误:

mysqldump: Error 1194: Table 'wp_options' is marked as crashed and should be repaired when dumping table `wp_options` at row: 111

感谢任何帮助。

0 个答案:

没有答案