2

我们的服务器已经运行 mysql 一年多了。我运行了一组 sql 脚本来构建一个相当大的数据库,在这些脚本的中间,我开始收到我失去连接的错误。据我们所知,没有人做过任何其他事情。当我尝试登录 mysql 时,我得到了:

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

当我尝试重新启动 mysql 时,我得到:

# sudo service mysql restart
stop: Unknown instance:
start: Job failed to start

error.log 显示:

130212  9:37:51 [Note] Plugin 'FEDERATED' is disabled.
130212  9:37:51 InnoDB: The InnoDB memory heap is disabled
130212  9:37:51 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130212  9:37:51 InnoDB: Compressed tables use zlib 1.2.7
130212  9:37:51 InnoDB: Using Linux native AIO
130212  9:37:51 InnoDB: Initializing buffer pool, size = 10.0G
130212  9:37:51 InnoDB: Completed initialization of buffer pool
130212  9:37:51 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 2186809272046
130212  9:37:51  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: Doing recovery: scanned up to log sequence number 2186814514688
InnoDB: Doing recovery: scanned up to log sequence number 2186816162838
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 27964 row operations to undo
InnoDB: Trx id counter is 18834200
130212  9:37:51  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 4424818.
InnoDB: You may have to recover from a backup.
130212  9:37:51  InnoDB: Page dump in ascii and hex (16384 bytes):
 len 16384; hex 058425e20043847200356a3f003e3720000001fd2807769645bf00000000000000000000000000ef31a083ca0000000031980005000003c8000$
InnoDB: End of page dump
18 130212  9:37:51  InnoDB: Page checksum 1501194131, prior-to-4.0.14-form checksum 441953139
InnoDB: stored checksum 92546530, prior-to-4.0.14-form stored checksum 1240647222
InnoDB: Page lsn 509 671577750, low 4 bytes of lsn at page end 441447404
InnoDB: Page number (if stored to page already) 4424818,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be an index page where index id is 1096815
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 4424818.
InnoDB: You may have to recover from a backup.
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.
InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: See also http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
130212  9:37:51  InnoDB: Assertion failure in thread 140114781574912 in file buf0buf.c line 3603
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
16:37:51 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=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 = 346681 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 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x29)[0x7f72aa2435b9]
/usr/sbin/mysqld(handle_fatal_signal+0x3d8)[0x7f72aa12c548]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f72a8c8dcb0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7f72a82f6425]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x17b)[0x7f72a82f9b8b]
/usr/sbin/mysqld(+0x605429)[0x7f72aa32d429]
/usr/sbin/mysqld(+0x631b69)[0x7f72aa359b69]
/usr/sbin/mysqld(+0x5c20a8)[0x7f72aa2ea0a8]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a)[0x7f72a8c85e9a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f72a83b3cbd]

我找不到任何为 mysql 运行的东西,包括任何套接字。我正在接替以前的 SysAdmin,并且对 linux 和 MySql 还很陌生。我们必须尽快让这个系统重新上线。请帮忙。

4

2 回答 2

4

您是否尝试将以下行添加到您的 /etc/mysql/my.cnf 然后重新启动服务器?

[mysqld]
innodb_force_recovery = 4
于 2013-02-12T17:12:16.680 回答
1

要添加到@elico3000,您现在需要转储损坏的表和数据以修复 innodb fs。有很多方法可以做到这一点。您可以通读日志以确定故障点和可能的表名,然后转储并重新创建这些特定表。或者您可以使用单个命令转储整个 MySQL 数据库和所有模式,但这需要一些时间,具体取决于您的数据库有多大。无论哪种方式,一旦您解决了损坏的表,您就可以将 innodb_force 选项设置为 0 并重新启动 mysqld_safe。

这是一个很好的关于 MyISAM 和 InnoDB MySQL 实例的恢复选项的教程,涵盖了一些选项。在这里指出你要容易得多,而不是在这个答案中再次重复命令和概念。

祝你好运,一旦你尝试了其中一种选择,就回来提出更尖锐的问题。那里可能有更多教程,但我在开发中使用它来重建我的开发数据库,​​它有很多信息。

这里

于 2013-02-12T19:44:15.943 回答