苹果电脑(Macbook)运行MySQL时,会出现 Operating system error number 87 in a file operation
错误,具体概率不清楚。目前遇到这错误的,都是在苹果电脑上使用Windows系统安装MySQL出现的,其它电脑没有遇到过这样的情况。
我们先来看看完整报错日志:
2021-04-08 10:32:55 17636 [Note] Plugin 'FEDERATED' is disabled.
2021-04-08 10:32:55 17636 [Note] InnoDB: The InnoDB memory heap is disabled
2021-04-08 10:32:55 17636 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2021-04-08 10:32:55 17636 [Note] InnoDB: Compressed tables use zlib 1.2.3
2021-04-08 10:32:55 17636 [Note] InnoDB: Not using CPU crc32 instructions
2021-04-08 10:32:55 17636 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2021-04-08 10:32:55 17636 [Note] InnoDB: Completed initialization of buffer pool
2021-04-08 10:32:55 17636 [Note] InnoDB: Highest supported file format is Barracuda.
2021-04-08 10:32:55 11fc InnoDB: Operating system error number 87 in a file operation.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2021-04-08 10:32:55 11fc InnoDB: File name .\ib_logfile0
2021-04-08 10:32:55 11fc InnoDB: File operation call: 'aio read' returned OS error 187.
2021-04-08 10:32:55 11fc InnoDB: Cannot continue operation.
可以看出,运行到一半就报InnoDB: Operating system error number 87 in a file operation.
错误,87
错误码对应的错误是参数不正确(ERROR_INVALID_PARAMETER)
。
根据网友给MySQL的反馈讨论,这问题可能是由硬盘扇区大小
导致的问题,我们可以尝试调整MySQL的配置来解决这问题。
打开my.ini
配置文件,找到innodb_flush_method
配置项,更改配置值为normal
。
如果没有找到该配置项,则直接在配置文件里的[mysqld]
节点增加一行新配置:
innodb_flush_method=normal
wampserver的配置节点名是
[wampmysqld64]
然后删除MySQL data目录下的所有文件,重新初始化数据库。
再尝试重新启动MySQL,看看是否正常。如果不正常,可以再根据错误日志继续解决问题。或者还可以试试以下方法:
- 使用最新版本MySQL
- 使用MariaDB数据库
- 换台电脑