解决InnoDB: Failing assertion: !lock->recursive

背景:
在arm服务器里运行MySQL5.7.22版本

报错信息 :

2024-11-25T08:07:36.241825+08:00 856 [Note] Multi-threaded slave statistics for channel '': seconds elapsed = 126; events assigned = 53431297; worker queues filled over overrun level = 0; waited due a Worker queue full = 0; waited due the total size = 0; waited at clock conflicts = 894612095100 waited (count) when Workers occupied = 76 waited when Workers occupied = 36574500
2024-11-25T08:09:36.383649+08:00 856 [Note] Multi-threaded slave statistics for channel '': seconds elapsed = 120; events assigned = 53462017; worker queues filled over overrun level = 0; waited due a Worker queue full = 0; waited due the total size = 0; waited at clock conflicts = 894781573600 waited (count) when Workers occupied = 76 waited when Workers occupied = 36574500
2024-11-25 08:10:43 0xffaa167160e0  InnoDB: Assertion failure in thread 281105986052320 in file sync0rw.cc line 560
InnoDB: Failing assertion: !lock->recursive
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.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
00:10:43 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.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=33554432
read_buffer_size=2097152
max_used_connections=4
max_threads=64020
thread_count=18
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 394231416 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0xffa990007f70
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 = ffaa167157a0 thread_stack 
### 解决方案 在处理 `mysqld` 的未知选项错误时,需注意不同版本的 MySQL 对于初始化命令的支持情况有所不同。以下是针对该问题的具体分析: #### 错误原因 根据提供的信息可知,“`--initialize-insecure`” 参数并非适用于所有 MySQL 版本。具体来说,在 MySQL 5.6 及更早版本中,并未引入此参数[^2]。因此当尝试使用此类参数执行初始化操作时,会触发 `[ERROR] mysqld: unknown option '--initialize-insecure'` 这样的错误提示。 对于 Windows 平台下安装 MySQL-5.7.31 而言,如果按照教程直接运行 `"D:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --initialize-insecure` 命令却遭遇失败,则可能是因为存在其他潜在因素干扰正常流程,比如配置文件中的多余内容影响解析逻辑等问题[^4]。 #### 正确做法 为了成功完成数据库实例的数据目录初始化工作而不遇到上述提到过的那些麻烦事,请遵循下面建议的操作方法: 1. **确认使用的MySQL版本**: 首先要清楚当前所部署的是哪个确切版号的服务端程序,因为这决定了哪些功能特性可用以及如何正确调用它们. 2. **调整初始化方式**: - 如果是较新的MySQL版本(如5.7及以上),应该采用官方推荐的标准形式来启动自动设置过程:`mysqld --initialize`,它会在后台自动生成随机密码并记录到error log里供后续访问验证身份之用; ```bash "D:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --initialize ``` - 若确实需要创建无需密码保护的新账户环境(即所谓的insecure模式),则可以考虑降级至适当的老版本或者手动编辑root用户的权限设定脚本来达成目标效果. 3. **检查my.ini配置文件**: 确保没有任何多余的非法条目混入其中扰乱正常的读取顺序;必要时候可以从备份恢复原始出厂默认状态再重新定制个性化修改项. 通过以上措施能够有效规避因误解文档说明而导致的技术难题发生概率极大降低. ```python # 示例Python代码片段用于演示如何连接已正确初始化完毕后的本地MYSQL服务 import mysql.connector try: connection = mysql.connector.connect( host='localhost', user='yourusername', # 替换为实际用户名 password='yourpassword') # 替换为实际密码 if connection.is_connected(): db_Info = connection.get_server_info() print(f"Connected to MySQL Server version {db_Info}") except Exception as e: print("Error while connecting to MySQL", e) finally: if (connection.is_connected()): connection.close() print("MySQL connection is closed") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值