CentOs 6.9 Mysqld failed to start (InnoDB Error: innodb_system data file './ibdata1' is of a different size)

CentOs 6.9 Mysqld failed to start (InnoDB Error: innodb_system data file './ibdata1' is of a different size)

升级到 php 5.5(我知道它很旧)并更新了我的 phpMyAdmin 版本,以及 MySQL 到 5.7,现在 MySQL 无法启动。 ..

查看 mysqld 日志: 2018-03-16T16:35:54.553247Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages! 2018-03-16T16:35:54.553310Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 2018-03-16T16:35:55.153859Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 2018-03-16T16:35:55.153924Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2018-03-16T16:35:55.153944Z 0 [ERROR] Failed to initialize builtin plugins. 2018-03-16T16:35:55.153964Z 0 [ERROR] Aborting

谁能告诉我为什么会这样。

配置文件 /etc/my.cnf 包含一个 innodb_xxxx,它指的是一个大小为 768 页的自动扩展。这可以包括像

这样的参数

innodb_data_home_dir

innodb_data_file_path

完整语法描述了这个值

file_name:file_size[:autoextend[:max:max_file_size]]

示例

innodb_data_file_path=/var/lib/mysql/ibdata1:768M:autoextend

如果您可以访问以前的工作 MySQL(就像您朋友的另一台服务器),请登录到 mysql 客户端并键入以下内容以查看 运行 配置

> SELECT @@GLOBAL.innodb_data_file_path;

+--------------------------------+
| @@GLOBAL.innodb_data_file_path |
+--------------------------------+
| ibdata1:10M:autoextend         |
+--------------------------------+

为什么会这样?

您现有的 innodb 存储文件小于 my.cnf 配置中指定的初始大小。

希望这能澄清问题。

我听从了你的建议并制定了一个解决方案,在 bash 中大约有 2 行,你就可以了。我在启动某些 mysql/mariadb 服务器或 docker 图像时看到以下消息:

The Auto-extending innodb_system data file './ibdata1' is of a different size 0 pages than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!

然后检测到以前的安装并且数据文件 space 不兼容。一个简单直接的解决方案是删除可能在主机上备份的现有容器映像。快速入门 Docker rmi 命令已准备好实现干净但不可逆的操作,您应该知道 docker 图像的名称,例如玛丽亚布:

docker rmi `docker images | grep mariadb | awk '{print }'`

重试 运行 新的 mysql 图像:

docker run -it mypersonalrepo/mariadb:latest &

数据库将使用space的InnoDB 768M数据进行初始化。