MySQL : mysqld got signal 6 ,数据库无法启动

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

本文主要描述MySQL服务器断电,启动之后,数据库无法启动,使用innodb_force_recovery=6进行恢复的案例。


欢迎转载,请注明作者、出处。

作者:张正
blog:http://space.itpub.net/26355921 
QQ:176036317
如有疑问,欢迎联系。

MySQL服务器遇断电,重启之后,数据库无法打开。具体报错信息如下:

140918 13:56:02 mysqld_safe Number of processes running now: 0

140918 13:56:02 mysqld_safe mysqld restarted

140918 13:56:02 InnoDB: The InnoDB memory heap is disabled

140918 13:56:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins

140918 13:56:02 InnoDB: Compressed tables use zlib 1.2.3

140918 13:56:02 InnoDB: Initializing buffer pool, size = 128.0M

140918 13:56:02 InnoDB: Completed initialization of buffer pool

140918 13:56:02 InnoDB: highest supported file format is Barracuda.

InnoDB: Log scan progressed past the checkpoint lsn 67376606

140918 13:56:02  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 67712828

140918 13:56:02  InnoDB: Starting an apply batch of log records to the database...

InnoDB: Progress in percents: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

InnoDB: Apply batch completed

140918 13:56:03  InnoDB: Waiting for the background threads to start

140918 13:56:04 InnoDB: 1.1.8 started; log sequence number 67712828

140918 13:56:04 [Note] Recovering after a crash using /data/mysql/binlog/mysql-bin

140918 13:56:04 [Note] Starting crash recovery...

140918 13:56:04 [Note] Crash recovery finished.

140918 13:56:04  InnoDB: Assertion failure in thread 1245067584 in file trx0purge.c line 829

InnoDB: Failing assertion: purge_sys->purge_trx_no <= purge_sys->rseg->last_trx_no

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.

05:56:04 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=8388608

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 = 338489 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...

140918 13:56:04 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306

stack_bottom = 0 thread_stack 0x40000

/usr/local/mysql5.5/bin/mysqld(my_print_stacktrace+0x2e)[0x76ad1e]

140918 13:56:04 [Note]   - '0.0.0.0' resolves to '0.0.0.0';

140918 13:56:04 [Note] Server socket created on IP: '0.0.0.0'.

/usr/local/mysql5.5/bin/mysqld(handle_fatal_signal+0x386)[0x655ba6]

/lib64/libpthread.so.0[0x3519e0eb70]

/lib64/libc.so.6(gsignal+0x35)[0x3519230265]

/lib64/libc.so.6(abort+0x110)[0x3519231d10]

/usr/local/mysql5.5/bin/mysqld[0x7ab5d4]

/usr/local/mysql5.5/bin/mysqld[0x7ad219]

/usr/local/mysql5.5/bin/mysqld[0x86a3cf]

/usr/local/mysql5.5/bin/mysqld[0x8617ee]

/usr/local/mysql5.5/bin/mysqld[0x7aad55]

140918 13:56:04 [Warning] 'user' entry 'root@wordpress' ignored in --skip-name-resolve mode.

140918 13:56:04 [Warning] 'user' entry '@wordpress' ignored in --skip-name-resolve mode.

/usr/local/mysql5.5/bin/mysqld[0x79f070]

140918 13:56:04 [Warning] 'proxies_priv' entry '@ root@wordpress' ignored in --skip-name-resolve mode.

/usr/local/mysql5.5/bin/mysqld[0x7a2836]

/lib64/libpthread.so.0[0x3519e0673d]

/lib64/libc.so.6(clone+0x6d)[0x35192d44bd]

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.
看到这个报错,提示可能是由于表空间数据文件报错引起的无法进行前滚或回滚,从而数据库无法打开。
由于数据库整体文件不是太大,就几个G,因此尝试了将该数据文件拷贝到另一个地方,编辑好参数文件等一些列工作。(因为这份数据是拷贝,尝试这样做一下,做坏了耶不要紧。如果真实数据只有一份,可别上来就这么干,一定要分析清楚了问题所在,再动手。)
在参数文件中加入innodb_force_recovery=6 ,然后尝试启动mysqld,结果起来了。 这时候数据库只能进行查询,使用 mysqldump将数据导出,然后重新搭建一套新的环境。
至于断电后那部分的数据,可以尝试从binlog中解析一下,然后再对比数据库中,查看是否有丢失的数据,具体的 此处不再详述。

本文转自ITPUB博客84223932的博客,原文链接:MySQL : mysqld got signal 6 ,数据库无法启动,如需转载请自行联系原博主。

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
14天前
|
SQL 数据可视化 关系型数据库
轻松入门MySQL:深入探究MySQL的ER模型,数据库设计的利器与挑战(22)
轻松入门MySQL:深入探究MySQL的ER模型,数据库设计的利器与挑战(22)
|
11天前
|
存储 关系型数据库 MySQL
MySQL基础入门:数据库操作全攻略
MySQL基础入门:数据库操作全攻略
44 0
|
11天前
|
关系型数据库 MySQL 数据库
卸载云服务器上的 MySQL 数据库
卸载云服务器上的 MySQL 数据库
30 0
|
1天前
|
SQL NoSQL 关系型数据库
初识MySQL数据库——“MySQL数据库”
初识MySQL数据库——“MySQL数据库”
|
3天前
|
关系型数据库 MySQL 数据库
数据库基础(mysql)
数据库基础(mysql)
|
3天前
|
SQL 关系型数据库 数据库
【后端面经】【数据库与MySQL】SQL优化:如何发现SQL中的问题?
【4月更文挑战第12天】数据库优化涉及硬件升级、操作系统调整、服务器/引擎优化和SQL优化。SQL优化目标是减少磁盘IO和内存/CPU消耗。`EXPLAIN`命令用于检查SQL执行计划,关注`type`、`possible_keys`、`key`、`rows`和`filtered`字段。设计索引时考虑外键、频繁出现在`where`、`order by`和关联查询中的列,以及区分度高的列。大数据表改结构需谨慎,可能需要停机、低峰期变更或新建表。面试中应准备SQL优化案例,如覆盖索引、优化`order by`、`count`和索引提示。优化分页查询时避免大偏移量,可利用上一批的最大ID进行限制。
17 3
|
4天前
|
存储 关系型数据库 MySQL
【后端面经】【数据库与MySQL】为什么MySQL用B+树而不用B树?-02
【4月更文挑战第11天】数据库索引使用规则:`AND`用`OR`不用,正用反不用,范围中断。索引带来空间和内存代价,包括额外磁盘空间、内存占用和数据修改时的维护成本。面试中可能涉及B+树、聚簇索引、覆盖索引等知识点。MySQL采用B+树,因其利于范围查询和内存效率。数据库不使用索引可能因`!=`、`LIKE`、字段区分度低、特殊表达式或全表扫描更快。索引与NULL值处理在不同数据库中有差异,MySQL允许NULL在索引中的使用。
10 3
|
5天前
|
关系型数据库 MySQL 数据库连接
Django(四):Django项目部署数据库及服务器配置详解(MySQL)
Django(四):Django项目部署数据库及服务器配置详解(MySQL)
28 11
|
10天前
|
关系型数据库 MySQL 数据库
mysql卸载、下载、安装(window版本)
mysql卸载、下载、安装(window版本)
|
1月前
|
关系型数据库 MySQL 数据库连接
关于MySQL-ODBC的zip包安装方法
关于MySQL-ODBC的zip包安装方法