Windows10 Docker Mariadb InnoDB: Write to file ./ibdata1 failed

错误描述

通过容器日志查到错误信息如下:

2020-01-05 13:06:14 0 [Warning] InnoDB: Retry attempts for writing partial data failed.

2020-01-05 13:06:14 0 [ERROR] InnoDB: Write to file ./ibdata1 failed at offset 0, 1048576 bytes should have been written, only 0 were written. Operating system error number 22. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded.

2020-01-05 13:06:14 0 [ERROR] InnoDB: Error number 22 means ‘Invalid argument’

2020-01-05 13:06:14 0 [ERROR] InnoDB: Could not set the file size of ‘./ibdata1’. Probably out of disk space

2020-01-05 13:06:14 0 [ERROR] InnoDB: Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.

2020-01-05 13:06:15 0 [ERROR] Plugin ‘InnoDB’ init function returned error.

2020-01-05 13:06:15 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.

2020-01-05 13:06:15 0 [ERROR] Unknown/unsupported storage engine: InnoDB

2020-01-05 13:06:15 0 [ERROR] Aborting

windows10 + Docker 安装 mariadb 时,一安装老是出现以上错误。创建命令如下:

docker run -d -p 3307 --name jmysql -v D:\MysqlData\:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=jjjjjj mariadb

解决办法

使用以下命令进行创建

docker run -d -p 3307:3306 --name jmysql -v D:\MysqlData\:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=jjjjjj mariadb --innodb-flush-method=fsync

创建时需要添加:

–innodb-flush-method=fsync

注:重新创建时需要将 d:\MysqlData 目录清空并重新建立容器。

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注