Mysql

MySQL 無法啟動一世nnoDBRepair一世nn這D乙R和p一種一世rInnoDB Repair

  • January 26, 2022

檢查日誌文件後,我發現一些數據庫有錯誤。

2017-05-16 08:52:48 7fc0cb8abb00  InnoDB: Assertion failure in thread 140466025315072 in file ha_innodb.cc line 21990
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.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
170516  8:52:48 [ERROR] 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.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

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.

Server version: 10.1.23-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=8
max_threads=10002
thread_count=8
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 22100835 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7fb8d3fd1008
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 = 0x7fc0cb8ab0b0 thread_stack 0x48400
2017-05-16  8:52:48 140466025618176 [ERROR] InnoDB:  InnoDB: Unable to allocate memory of size 18446744073709545072.

2017-05-16 08:52:48 7fc0cb8f5b00  InnoDB: Assertion failure in thread 140466025618176 in file ha_innodb.cc line 21990
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.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.

InnoDB 恢復設置為 3,但我不明白為什麼它要分配那麼多記憶體來恢復數據庫!

我以前遇到過這個問題,並按照本指南解決了這個問題:

恢復它的步驟。

  1. 停止 mysqld。
  2. 備份 /var/lib/mysql/ib*
  3. 將以下行添加到 /etc/my.cnf

innodb_force_recovery = 4

  1. 重啟mysqld。
  2. 轉儲所有表:# mysqldump -A > dump.sql
  3. 刪除所有需要恢復的數據庫。
  4. 停止 mysqld。
  5. 刪除 /var/lib/mysql/ib*
  6. 註釋掉 /etc/my.cnf 中的 innodb_force_recovery
  7. 重啟mysqld。查看mysql錯誤日誌。預設情況下,它應該是 /var/lib/mysql/server/hostname.com.err 以查看它如何創建新的 ib* 文件。
  8. 從轉儲中恢復數據庫:mysql < dump.sql

**提示:查找所有 InnoDB 表的簡單查詢,以防您想專門針對損壞。

SELECT table_schema, table_nameFROM INFORMATION_SCHEMA.TABLESWHERE engine = 'innodb';

引用自:https://serverfault.com/questions/850329