MySQL 报错 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file

本文讲述了作者在使用Wamp环境时遇到的MySQL启动失败问题,通过排查日志发现配置错误和权限问题,最终解决了InnoDB表空间和系统数据文件的可写性问题。详细步骤包括修复datadir配置、解决ibdata1文件权限问题,以及清理ib_logfile0和ib_logfile1。

本地装了 Wamp 的环境,启动时 MySQL 启动失败,查看启动失败的日志,日志如下:

2021-08-21T12:46:57.183482Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file .\ibdata1 are 0x4800!
2021-08-21 20:46:57 0xf48  InnoDB: Assertion failure in thread 3912 in file ut0ut.cc line 942
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.
12:46:57 UTC - mysqld got exception 0x80000003 ;
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.

后来在网上查,很多人都是用了 MySQL 8 以后再用 MySQL 5.7 后报这个问题,然后我本地也是这种情况。后来我检查 my.ini 文件,发现其中有一项配置 datadir 的目录指向是有问题的,修改一下即可。

然后再次启动,报下面的错误:

2021-08-21T12:57:29.873841Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2021-08-21T12:57:29.874698Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2021-08-21T12:57:29.875239Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-21T12:57:30.090440Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-21T12:57:30.091251Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-21T12:57:30.091811Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-21T12:57:30.092185Z 0 [ERROR] Aborting

然后按照网上的方法,删掉 MySQL 安装目录下的 data 目录下的 ib_logfile0 和 ib_logfile1 即可,如果这两个文件删除不掉,那么就在进程列表中找到 mysqld 将其结束即可。

图片

 

iot-database | 2025-07-04T08:35:21.579433Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). iot-database | 2025-07-04T08:35:21.591130Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800! iot-database | 2025-07-04 08:35:21 0x7fb876c66880 InnoDB: Assertion failure in thread 140430243424384 in file ut0ut.cc line 921 iot-database | InnoDB: We intentionally generate a memory trap. iot-database | InnoDB: Submit a detailed bug report to http://bugs.mysql.com. iot-database | InnoDB: If you get repeated assertion failures or crashes, even iot-database | InnoDB: immediately after the mysqld startup, there may be iot-database | InnoDB: corruption in the InnoDB tablespace. Please refer to iot-database | InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html iot-database | InnoDB: about forcing recovery. iot-database | 08:35:21 UTC - mysqld got signal 6 ; iot-database | This could be because you hit a bug. It is also possible that this binary iot-database | or one of the libraries it was linked against is corrupt, improperly built, iot-database | or misconfigured. This error can also be caused by malfunctioning hardware. iot-database | Attempting to collect some information that could help diagnose the problem. iot-database | As this is a crash and something is definitely wrong, the information iot-database | collection process might fail.
最新发布
07-05
2025-06-22T11:00:33.239825Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path. 2025-06-22T11:00:33.239825Z 0 [Note] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld (mysqld 5.7.11) starting as process 26108 ... 2025-06-22T11:00:33.246823Z 0 [ERROR] Can't open shared library 'C:\web\mysql\lib\plugin\keyring_file.dll' (errno: 126 找不到指定的模块。) 2025-06-22T11:00:33.247825Z 0 [ERROR] Couldn't load plugin named 'keyring_file' with soname 'keyring_file.dll'. 2025-06-22T11:00:33.248825Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2025-06-22T11:00:33.249820Z 0 [Note] InnoDB: Uses event mutexes 2025-06-22T11:00:33.251886Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier 2025-06-22T11:00:33.252866Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 2025-06-22T11:00:33.252866Z 0 [Note] InnoDB: Number of pools: 1 2025-06-22T11:00:33.252866Z 0 [Note] InnoDB: Not using CPU crc32 instructions 2025-06-22T11:00:33.285824Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2025-06-22T11:00:33.289823Z 0 [Note] InnoDB: Completed initialization of buffer pool 2025-06-22T11:00:33.322821Z 0 [Note] InnoDB: Setting log file .\ib_logfile101 size to 48 MB 2025-06-22T11:00:33.342815Z 0 [Note] InnoDB: Setting log file .\ib_logfile1 size to 48 MB 2025-06-22T11:00:33.362882Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file .\ibdata1 are 0x4800! 2025-06-22 19:00:33 0x65bc InnoDB: Assertion failure in thread 26044 in file ut0ut.cc line 920 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.m
06-23
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农UP2U

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值