异常错误

某一天, 运行虚拟机, 突然mysql启动失败, 报一下错误:

[root@localhost Web]# docker-compose up mysql
Starting soul-mysql ... done
Attaching to soul-mysql
soul-mysql | 2021-03-01 08:39:33+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
soul-mysql | 2021-03-01 08:39:33+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
soul-mysql | 2021-03-01 08:39:33+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
soul-mysql | 2021-03-01T08:39:35.341341-00:00 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 1
soul-mysql | 2021-03-01T08:39:35.389615-00:00 0 [Warning] [MY-012360] [InnoDB]  Option innodb_dedicated_server is ignored for innodb_log_file_size because innodb_log_file_size=2147483648 is specified explicitly.
soul-mysql | 2021-03-01T08:39:35.400951-00:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
soul-mysql | 2021-03-01T08:39:40.537325-00:00 1 [ERROR] [MY-012961] [InnoDB] Only one log file found
soul-mysql | 2021-03-01T08:39:40.538289-00:00 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error not found.
soul-mysql | 2021-03-01T08:39:40.798053-00:00 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
soul-mysql | 2021-03-01T08:39:40.800428-00:00 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
soul-mysql | 2021-03-01T08:39:40.801215-00:00 0 [ERROR] [MY-010119] [Server] Aborting
soul-mysql | 2021-03-01T08:39:40.805222-00:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23)  MySQL Community Server - GPL.

指定新的挂载目录运行正常, 搜遍全网都没有找到答案

解决办法:

删除以下文件(建议删除前备份):

data/ib_logfile0
data/ib_logfile1
...

重新启动就可以了

原因

主要是因为我修改了虚拟机的内存分配, 导致mysql 8写日志的大小计算出了问题.
删除文件让mysql重新生成OK, 或者可以把虚拟机设置为原来分配的内存大小

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐